Using Dot Net 8 and Syncfusion v 26.2.11
I have the following code:
@page "/test"
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Grids
@using Syncfusion.Blazor.Data
<h3>Test</h3>
<SfGrid TValue="User">
<SfDataManager Url="api/user" Adaptor="Adaptors.WebApiAdaptor" ></SfDataManager>
<GridEvents TValue="User" OnActionFailure="@ActionFailure"></GridEvents>
</SfGrid>
@code {
public void ActionFailure(Syncfusion.Blazor.Grids.FailureEventArgs args)
{
}
public class User
{
public int UserId { get; set; }
public string Username { get; set; }
}
}
The api/user call returns the following (generated by EF core):
[{"$id":"1","userId":1,"username":"[email protected]"},{"$id":"2","userId":2,"username":"[email protected]"},{"$id":"3","userId":4,"username":"[email protected]"},{"$id":"4","userId":5,"username":"[email protected]"},{"$id":"5","userId":13,"username":"[email protected]"},{"$id":"6","userId":14,"username":"Baanan"}]
I get an error trapped on entry to ActionFailure method:
{"The JSON value could not be converted to System.Collections.Generic.List`1[ProjName.Pages.Test+User]. Path: $.items | LineNumber: 0 | BytePositionInLine: 20."}
I dont understand why I get this error. Help!
Martin