# TXSheetControl Class

> TXSheetControl class in the .NET API: Razor component that owns a browser spreadsheet editor and provides typed lifecycle, workbook and selection callbacks.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Namespace:** `TXTextControl.TXSheetControl.Blazor`
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Blazor.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Inherits:** `Microsoft.AspNetCore.Components.ComponentBase`
- **Implements:** `System.IAsyncDisposable`
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Blazor > TXSheetControl Class
- **2011 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/llms-full.txt

---

Razor component that owns a browser spreadsheet editor and provides typed lifecycle, workbook and selection callbacks.

### Syntax

```csharp
public class TXSheetControl
```

### Members

| Member | Description |
|---|---|
| [Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/constructor/llms-full.txt) | Creates TXSheetControl settings or event data for the component. |
| [Changed](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/changed-property/llms-full.txt) | Completed workbook transactions with worksheet and address context. |
| [Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/class-property/llms-full.txt) | Optional CSS class on the Blazor-owned host. |
| [Control](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/control-property/llms-full.txt) | Typed browser document host, available after Ready. It has the same Workbook API as ServerSheetControl. |
| [DisposeAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/disposeasync-method/llms-full.txt) | Releases this editor and module reference when its component leaves the render tree. |
| [Edited](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/edited-property/llms-full.txt) | Completed cell edits; asynchronous handlers cannot cancel committed edits. |
| [Error](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/error-property/llms-full.txt) | Initialization and event-handler failures. Invoked API methods also report failures by throwing. |
| [Event](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/event-property/llms-full.txt) | All forwarded completed workbook notifications and file progress. |
| [Height](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/height-property/llms-full.txt) | Editor host height in CSS pixels, from 100 through 10000. |
| [Loaded](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/loaded-property/llms-full.txt) | Successful document replacement, including detached conversion warnings. |
| [Options](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/options-property/llms-full.txt) | Required browser settings. License and worksheet capacities apply when the component is first mounted. |
| [Ready](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/ready-property/llms-full.txt) | Raised after browser license verification, font discovery and editor initialization. |
| [Saved](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/saved-property/llms-full.txt) | Successful document export. |
| [SelectionChanged](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/selectionchanged-property/llms-full.txt) | Detached screen selection changes. |
| [Style](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/style-property/llms-full.txt) | Additional host CSS declarations. Editor styles remain in Shadow DOM. |

### Examples

```cshtml
@using TXTextControl.TXSheetControl.Blazor
@using TXTextControl.TXSheetControl.Server
@inject Microsoft.Extensions.Configuration.IConfiguration Configuration
<TXSheetControl Options="options" Ready="OnReady" Error="OnError" Height="640" Class="sheet-editor" Style="width:100%" @ref="component"
    Changed="OnNotification" Edited="OnNotification" Loaded="OnNotification"
    Saved="OnNotification" Event="OnNotification" SelectionChanged="OnSelection" />
<p role="status">@status</p>
@code {
    private TXSheetControl? component;
    private void OnNotification(WorkbookEventArgs args) { status = "Workbook updated"; }
    private void OnSelection(SelectionChangedEventArgs args) { status = $"{args.Active} on {args.SheetId}"; }
    private SheetControlOptions options = default!;
    private string status = "Initializing";
    protected override void OnInitialized() => options = new()
    { License = Configuration["TXSheetControl:License"] ?? "", Rows = 2000, Columns = 20 };
    private async Task OnReady(BlazorSheetControl control)
    {
        var sheet = await control.Workbook.Sheets.AtAsync(0);
        await sheet.Range("A1:D2").SetValuesAsync([
            ["Item", "Quantity", "Price", "Total"], ["Notebook", 5, 12, null]
        ]);
        await sheet.Cell("D2").SetFormulaAsync("=B2*C2");
        await sheet.Range("A1:D1").FormatAsync(new { font = new { bold = true } });
        status = $"Ready ({(await control.GetLicenseInfoAsync()).Type})";
    }
    private void OnError(SheetControlErrorEventArgs error) =>
        status = $"{error.Code}: {error.Message}";
}
```

### Remarks

Use the component only after interactive rendering. Browser document operations execute in the editor through JavaScript interop. Completed notifications cannot synchronously cancel edits.

### See Also

- [Blazor Tutorial](https://docs.textcontrol.com/tx-sheet-control/getting-started/spreadsheet-editor/blazor/llms-full.txt).

---

## In This Section

- [TXSheetControl.Changed Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/changed-property/llms-full.txt): TXSheetControl.Changed property in the TX Sheet Control .NET API: Completed workbook transactions with worksheet and address context.
- [TXSheetControl.Class Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/class-property/llms-full.txt): TXSheetControl.Class property in the TX Sheet Control .NET API: Optional CSS class on the Blazor-owned host element of the spreadsheet editor component.
- [TXSheetControl Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/constructor/llms-full.txt): TXSheetControl constructor in the TX Sheet Control .NET API: Creates the Razor component, which Blazor normally constructs and owns through component markup.
- [TXSheetControl.Control Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/control-property/llms-full.txt): TXSheetControl.Control property in the TX Sheet Control .NET API: Typed BlazorSheetControl host, available after Ready, with the Workbook API of the server.
- [TXSheetControl.DisposeAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/disposeasync-method/llms-full.txt): TXSheetControl.DisposeAsync method in the TX Sheet Control .NET API: Releases this editor and module reference when its component leaves the render tree.
- [TXSheetControl.Edited Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/edited-property/llms-full.txt): TXSheetControl.Edited property in the TX Sheet Control .NET API: Completed cell edits; asynchronous handlers cannot cancel committed edits.
- [TXSheetControl.Error Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/error-property/llms-full.txt): TXSheetControl.Error property in the TX Sheet Control .NET API: Initialization and event-handler failures; invoked API methods also report failures by throwing.
- [TXSheetControl.Event Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/event-property/llms-full.txt): TXSheetControl.Event property in the TX Sheet Control .NET API: All forwarded completed workbook notifications and file progress.
- [TXSheetControl.Height Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/height-property/llms-full.txt): TXSheetControl.Height property in the TX Sheet Control .NET API: Editor host height in CSS pixels, from 100 through 10000.
- [TXSheetControl.Loaded Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/loaded-property/llms-full.txt): TXSheetControl.Loaded property in the TX Sheet Control .NET API: Successful document replacement, including detached conversion warnings.
- [TXSheetControl.Options Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/options-property/llms-full.txt): TXSheetControl.Options property in the .NET API: Required SheetControlOptions; license and worksheet capacities apply when the component is first mounted.
- [TXSheetControl.Ready Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/ready-property/llms-full.txt): TXSheetControl.Ready property in the TX Sheet Control .NET API: Raised after browser license verification, font discovery and editor initialization.
- [TXSheetControl.Saved Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/saved-property/llms-full.txt): TXSheetControl.Saved property in the TX Sheet Control .NET API: EventCallback with WorkbookEventArgs, raised after a successful document export.
- [TXSheetControl.SelectionChanged Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/selectionchanged-property/llms-full.txt): TXSheetControl.SelectionChanged property in the TX Sheet Control .NET API: EventCallback with a detached SelectionChangedEventArgs per selection change.
- [TXSheetControl.Style Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/style-property/llms-full.txt): TXSheetControl.Style property in the TX Sheet Control .NET API: Additional host CSS declarations; the editor's own styles remain in Shadow DOM.

---

## Nearby

- **Previous:** [SheetControlOptions.Zoom Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/sheetcontroloptions/zoom-property/llms-full.txt)
- **Next:** [TXSheetControl Constructor](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/txsheetcontrol/constructor/llms-full.txt)
