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;

  
    }
}

3 Replies 1 reply marked as answer

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

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 



PG Peter Groft December 16, 2022 08:07 AM UTC

Go to Solution. Please click the file->Options and Settings->Data Source Settings, and you will get the following data source settings navigator. Then select change source(highlighted in red line), please check the path, and open the file in the right format.


Greetings,

Peter


Marked as answer

SG Suganya Gopinath Syncfusion Team December 20, 2022 04:31 AM UTC

Peter,

Thank you for the suggestion shared to solve the issue. This will be very useful.

Please get back to us for further assistance. 

Regards,

Suganya Gopinath.


Loader.
Up arrow icon