# BlazorSheetControl.GetSelectionAsync Method

> BlazorSheetControl.GetSelectionAsync method in the TX Sheet Control .NET API: Reads the current screen selection as a detached SelectionChangedEventArgs.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Namespace:** `TXTextControl.TXSheetControl.Blazor`
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Blazor.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Blazor > BlazorSheetControl > BlazorSheetControl.GetSelectionAsync Method
- **473 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/getselectionasync-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/getselectionasync-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/getselectionasync-method/llms-full.txt

---

Reads detached current screen selection.

### Syntax

```csharp
public Task<SelectionChangedEventArgs> GetSelectionAsync(CancellationToken cancellationToken = default)
```

### Parameters

| Name | Type | Description |
|---|---|---|
| `cancellationToken` | `CancellationToken` | Cancellation before starting the operation, with cooperative cancellation for supported file work. |

### Return Value

`Task<SelectionChangedEventArgs>`. The awaited operation result, detached from browser transport.

### Exceptions

API failures throw `ServerSheetControlException` with a code. A canceled operation throws `OperationCanceledException`. Browser filesystem overloads and synchronous C# cell renderers throw `PlatformNotSupportedException`.

### Examples

The `control` variable is the host received by `Ready`. File examples use caller-provided `xlsxBytes`.

```csharp
var selection = await control.GetSelectionAsync();
var sheet = await control.Workbook.Sheets.GetByIdAsync(selection.SheetId);
await sheet.Cell(selection.Active).SetValueAsync("Selected cell");
```

### Remarks

Await asynchronous operations. Replacement workbook loads invalidate earlier worksheet, cell and range handles. Browser callbacks report completed notifications.

### See Also

- [BlazorSheetControl](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/llms-full.txt).

---

## Nearby

- **Previous:** [BlazorSheetControl.GetPrintLayoutAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/getprintlayoutasync-method/llms-full.txt)
- **Next:** [BlazorSheetControl.GetUserNameAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/getusernameasync-method/llms-full.txt)
