Radzen Blazor DataGrid - Disable (some) row from selected

Is it possible to not allow select for specific row in DataGrid?

In the DataGrid, I enable row selection with AllowRowSelectOnRowClick=true. In each Item row, it has a property IsAvailable and it determines whether the row can be ticked/selected (refer to Code section OnSelectRow).

While I have another set of List, OriSelectData with store the Item with IsAvailable=false. With this OriSelectData list, I can hide the checkbox so it is not allowed to be selected.


It seems even with this OnSelectRow method, the row (with IsAvailable=false) is still able to be selected. And I checked the SelectedData, the row was added after RowClick or RowSelect event.

I am not able to block the IsAvailable=false item to be selected.

Expected result:
When user click the row (IsAvailable=false a.k.a no checkbox), the row should not be selected, highlighted.

Actual result:
The row (IsAvailable=false a.k.a no checkbox), the row was selected, highlighted.



<RadzenDataGrid @ref="grid" AllowRowSelectOnRowClick="@allowRowSelectOnRowClick" AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
                            AllowSorting="true" Data="@Data" TItem="Item" ColumnWidth="200px"
                            RowSelect="@(args => OnSelectRow(args))" RowClick="@(args => OnSelectRow(args.Data))">
                    <RadzenDataGridColumn TItem="Item" Width="40px" Sortable="false" Filterable="false">
                            <RadzenCheckBox TriState="false" TValue="bool" Value="@(Data.Any(i => SelectedData != null && SelectedData.Contains(i)))"
                                            Change="@(args => SelectedData = args ? Data.ToList() : null)" />
                        <Template Context="data">
                            <RadzenCheckBox TriState="false" Value="@(SelectedData != null && SelectedData.Contains(data))"
                                            TValue="bool" Change=@(args => OnSelectRow(data))
                                            Disabled="@(OriSelectedData != null && OriSelectedData.Contains(data.DisplayName))"
                                            Visible="@(!(OriSelectedData!= null && OriSelectedData.Contains(data.DisplayName)))"/>

                    <RadzenDataGridColumn TItem="Data" Property="Name" Title="Name" />
public void OnSelectRow(Item item)
    // Allow row to be select
    if (!allowRowSelectOnRowClick && item.IsAvailable)

    // Remove row from select (This part fail)
    //var selected = SelectedData?.First(x => x.DisplayName == item.DisplayName);


public record Item(string DisplayName, bool IsAvailable);

Thanks in advance for the assist.

If you set this to false you can control the selection from the CheckBox and bind Disabled property of the CheckBox to your property that defines if row can be selected or not.