selected records being removed after performing an action

How do I keep selected records from being removed  from selected list after performing an action ?



1 Reply

GR Guhanathan Ramanathan Syncfusion Team March 17, 2026 11:20 AM UTC

Hi Dip Gadhethariya,

Based on your query, we understand that you want to persist the selection after performing an action. To meet this requirement, you can use the PersistSelection feature, which retains the selection even after an action is executed. We have already discussed about this in our documentation which can be accessed using the below link,

Documentation: https://blazor.syncfusion.com/documentation/datagrid/selection?cs-save-lang=1&cs-lang=csharp#persist-selection

For you convenience, we have prepared a sample and achieved your requirement. Please refer the code snippet and attached sample for your reference.

 

<SfGrid DataSource="@OrderData" AllowSelection="true" AllowPaging="true" Height="315">

    <GridSelectionSettings PersistSelection="true"  Type="Syncfusion.Blazor.Grids.SelectionType.Multiple"></GridSelectionSettings>

    <GridPageSettings PageSize="5"></GridPageSettings>

    <GridColumns>

        <GridColumn Field=@nameof(OrderDetails.OrderID) HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Syncfusion.Blazor.Grids.TextAlign.Right" Width="120"></GridColumn>

        <GridColumn Field=@nameof(OrderDetails.CustomerID) HeaderText="Customer ID" Width="150"></GridColumn>

        <GridColumn Field=@nameof(OrderDetails.ShipCity) HeaderText="Ship City" Width="120"></GridColumn>

        <GridColumn Field=@nameof(OrderDetails.ShipName) HeaderText="Ship Name" Width="150"></GridColumn>

    </GridColumns>

</SfGrid>

Note: When using PersistSelection, ensure that at least one column in the Grid is configured as a primary key. This allows the Grid to correctly identify and retain selected items.


Regards,
Guhanathan R 


Loader.
Up arrow icon