How can I store sorting info before grid is reloaded?

I have the following grid:

<RadzenDataGrid @ref="_dataGrid" Data="IFilteredDataS"
    AllowSorting="true" TItem="Data" @bind-Value="SelectedData">
        <RadzenDataGridColumn Property="Foo"
            SortOrder="SortOrder.Ascending" TItem="Data">
        <RadzenDataGridColumn Property="Bar" TItem="Data">


public IList<Data> SelectedData { get; set; }
public IEnumerable<Data> IFilteredDataS { get; set; }

There are Radzen Range Sliders to filter the grid data and if the user does so, the grid is emptied and new data is loaded:

_suitableDataS.ForEach((item) =>
IFilteredDataS = _filteredDataS;

My problem is, that when the user sorts by column "Bar", after reloading the grid, data is sorted by the default column "Foo". Is there way to
  • either avoid this or
  • store sort column and sort order and set it after reload?

Many thanks


You should bind this to a variable

I tried it with



private Radzen.SortOrder _fooSortOrder = Radzen.SortOrder.Ascending;

but get the unhandled error

Radzen.Blazor.RadzenDataGridColumn does not have a property matching the name 'SortOrderChanged'

In addition: How can I store "not sorted"? The enum only allows ascending and descending
This is necessary because I also must store the sort info about column "bar" for the case the user sorts by this column.



private Radzen.SortOrder _barSortOrder = Radzen.SortOrder.NOTSORTED;

Thanks again


Just set the property

But in column Foo, I need


and in column Bar



private Radzen.SortOrder _fooSortOrder;
private Radzen.SortOrder _barSortOrder;

this leads to
The indicators depict ascending order but the columns are not sorted.

Also, whenever I break my app, _fooSortOrder and _barSortOrder are always Ascending. There is no binding and therefore, I cannot store the value. That's why I tried @bind-SortOrder="@_fooSortOrder, when you recommended

This morning I tried to achieve storing the sorting info with @ref at the RadzenDataGridColumn but was not successful. I am running out of ideas...
Is there a solution or is it simply not possible to store sorting information?

With the recent addition of the DataGridColumnSortEventArgs I believe you could manually handle the sort events to resolve your issue. The new events haven't been released yet, but I suspect they will be in the next release

I will try, when the next update is published...