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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error when setting data source in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

145348 Jun 18,2019 10:56 AM UTC Jun 19,2019 05:13 AM UTC Blazor 1
loading
Tags: Grid
Ivan Petrov
Asked On June 18, 2019 10:56 AM UTC

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;

  
    }
}

Vijayanand S [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon