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

Error when setting data source in grid

Hello when setting the grid DataSource I am getting the following error: Uncaught (in promise) Error: System.InvalidCastException: Invalid cast from 'System.String' to 'Syncfusion.EJ2.RazorComponents.DataManagerRequest'. My code is: 

<EjsGrid id="Grid" ref="otherGrid" >
    <GridEditSettings allowAdding="true" allowEditing="true" allowDeleting="true" Mode="@EditMode.Dialog"></GridEditSettings>
    <GridColumns>
        <GridColumn ref=@col Field=@nameof(OrdersDetails.CustomerID) HeaderText="Customer Name" Width="120"></GridColumn>
        <GridColumn Field=@nameof(OrdersDetails.OrderDate) HeaderText=" Order Date" Format="yMd" TextAlign="@TextAlign.Right" Width="130"></GridColumn>
        <GridColumn Field=@nameof(OrdersDetails.Freight) HeaderText="Freight" Format="C2" TextAlign="@TextAlign.Right" MinWidth="10" Width="120" MaxWidth="200"></GridColumn>
        <GridColumn Field=@nameof(OrdersDetails.ShipCountry) HeaderText="Ship Country" Width="150"></GridColumn>
    </GridColumns>
</EjsGrid>

@functions{
    GridColumn col;
    // EjsGrid defaultGrid;
    EjsGrid otherGrid;

    public string Temp { get; set; }

    public List<OrdersDetails> gridData { get; set; }

    protected override void OnAfterRender()
    {
        base.OnAfterRender();
        this.otherGrid.DataSource = OrdersDetails.GetAllRecords();
        col.Template = "<a rel='nofollow' href='counter'>redirect</a>";
        this.otherGrid.GridLines = GridLine.Both;

  
    }
}

1 Reply

VS Vijayanand S Syncfusion Team June 19, 2019 12:13 AM

Hi Ivan, 

Could you please confirm that you have upgraded your project to .NET Core 3.0 Preview 6 version? If so, we suspect that your project may use the older NuGet package or browser still has the older script files, so we recommend you to clear the NuGet cache and browser cache and run your application.   
  1. Delete / clear the package Syncfusion.EJ2.AspNet.Core.RazorComponents from the installed location ({system-driver}\Users\{user-name}\.nuget\packages\syncfusion.ej2.aspnet.core.razorcomponents).
  2. Update Syncfusion.EJ2.AspNet.Core.RazorComponents to their latest version 17.1.0.52-beta using NuGet package manager.
  3. Refresh the browser using Ctrl+F5 to force to cache refresh and fetch the latest scripts.
Please let me know if this helps. 

Vijay 


Loader.
Live Chat Icon For mobile
Up arrow icon