We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

datagrid server side paging and sorting

am trying to follow this tutorial https://docs.abp.io/en/abp/latest/Tutorials/Part-9?UI=Blazor&DB=EF , but just with  SfGrid, i am looking for some guidance  on how to convert :

private async Task GetAuthorsAsync()


    var result = await AuthorAppService.GetListAsync(

        new GetAuthorListDto


            MaxResultCount = PageSize,

            SkipCount = CurrentPage * PageSize,

            Sorting = CurrentSorting



    AuthorList = result.Items;

    TotalCount = (int)result.TotalCount;


private async Task OnDataGridReadAsync(DataGridReadDataEventArgs<AuthorDto> e)


    CurrentSorting = e.Columns

        .Where(c => c.SortDirection != SortDirection.Default)

        .Select(c => c.Field + (c.SortDirection == SortDirection.Descending ? " DESC" : ""))


    CurrentPage = e.Page - 1;

    await GetAuthorsAsync();

    await InvokeAsync(StateHasChanged);


to work with SfGrid, the thing a got so far is using ActionBeginHandler but then i need a way to set the grid totalcount.

1 Reply

PS Prathap Senthil Syncfusion Team December 16, 2022 12:56 PM UTC

Hi Mohammed

Greeting from Syncfusion support,

Query:” I need a way to set the grid total count

Based on your query, we suggest that you use the count method from the grid instance to get the total count from the datasource. 

Please see the attached code snippet for reference.

<SfGrid DataSource="@OrderData.GetAllOrders()"TValue="Order"ID="Grid"






     <GridPageSettings PageSize="10"></GridPageSettings>

    <GridEditSettings AllowAdding="true"






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


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



  SfGrid<Order> Grid;


  var count = Grid.DataSource.Count();


Please get back to us for further details.

Prathap S

Live Chat Icon For mobile
Up arrow icon