Blazorise DataGrid: Single Selection
The DataGrid allows you to select rows with the click of a mouse.
Examples
Selecting
If you need to control how and when the grid row will be selected you can use aRowSelectable event handler. Here's a simple example where John's row is not selectable:
<DataGrid TItem="Employee" Data="" RowSelectable=@((x)=> x.Item.FirstName != "John") Responsive> <DataGridColumn Field="@nameof( Employee.FirstName )" Caption="Name" Editable="false" /> </DataGrid>
@code{ private List<Employee> employeeList = new() { new() { FirstName = "David" }, new() { FirstName = "MLaden" }, new() { FirstName = "John" }, new() { FirstName = "Ana" }, new() { FirstName = "Jessica" } }; }
Hide code example
Copy full example
API
See the API reference for the parameters, events, methods, and related types available to the components covered on this page.