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

Exception on grid sorting

I get following exception when I click column to sort,

System.InvalidOperationException: No generic method 'OrderBy' on type 'System.Linq.Queryable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic

here is my code

@page "/roles"
@using CMSAdmin.Shared
@using Syncfusion.EJ2.RazorComponents
@using Syncfusion.EJ2.RazorComponents.Grids
@using Syncfusion.EJ2.RazorComponents.Inputs
@using Syncfusion.EJ2.RazorComponents.Popups
@inject HttpClient Http

@if (roles == null)
    <EjsGrid id="Grid" DataSource="@roles" AllowSorting="true">
        <GridColumn Field=@nameof(Role.Id) HeaderText="Id" Visible="false" AllowSorting="true" ></GridColumn>
        <GridColumn Field=@nameof(Role.Name) HeaderText="Role" AllowSorting="true" ></GridColumn>
        <GridColumn Field=@nameof(Role.Description) HeaderText="Description" AllowSorting="false" ></GridColumn>
        <GridColumn Field=@nameof(Role.IsActive) HeaderText="Is Active" AllowSorting="false" ></GridColumn>

@functions {
    //Role[] roles;
    IList<Role> roles;
    EjsGrid defaultGrid;
    protected override async Task OnInitAsync()
        roles = await Http.GetJsonAsync<IList<Role>>("api/roles");

1 Reply

HJ Hariharan J V Syncfusion Team May 30, 2019 04:01 PM UTC

Hi Jawaid, 
Thanks for contacting Syncfusion support. 
We have checked your query and tried to reproduce the issue, but it the sorting is working fine at our end. We have prepared a sample where you can sort the columns without any issue. Please refer the below code snippet and sample link. 
@page "/" 
<h1>Hello, world!</h1> 
Welcome to your new app. 
<SurveyPrompt Title="How is Blazor working for you?" /> 
@using Syncfusion.EJ2.RazorComponents.Grids; 
@using WebApplication1.Shared.Models; 
@using Syncfusion.EJ2.RazorComponents.TreeGrid; 
@inject HttpClient  client 
<EjsGrid id="Grid" ref="@grid" DataSource="@data" AllowSorting="true"> 
            <GridColumn Field="@nameof(Employee.EmployeeID)" HeaderText="Order ID" ISPrimaryKey="true" TextAlign="@Syncfusion.EJ2.RazorComponents.Grids.TextAlign.Right" Width="90" AllowSorting="true"></GridColumn> 
            .   .  .  . 
            <GridColumn Field="@nameof(Employee.City)" HeaderText="City" Width="150" AllowSorting="false"></GridColumn> 
    Employee[] data; 
    EjsGrid grid; 
    protected override async Task OnInitAsync() 
        this.data = await client.GetJsonAsync<Employee[]>("api/Default"); 
If you are still facing the issue please provide the below details that will be helpful for us to provide a better solution as early as possible. 
  1. Share the stack trace of the exception.
  2. Share the reproducible sample/video demo of the issue.

Live Chat Icon For mobile
Up arrow icon