I am trying to use the DataGrid and I'm getting an error on binding. The error is:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Unable to set property 'DataSource' on object of type 'IgniteUI.Blazor.Controls.DataGrid'. The error was: Blazor.platform.readInt64Field is not a function
The grid is a very simple grid defined:
<DataGrid Width="100%" Height="100%" AutoGenerateColumns="false" DataSource="HmpContractors"> <NumericColumn Field="Id" IsHidden="true" /> <TextColumn Field="Name" HeaderText="Name" /> </DataGrid>
Here is a sample of the JSON data it is trying to bind to:
"certifications": [ { "id": 1, "certificationName": "WCLA" } ], "policies": [], "notes": "Steve Skaglund - Co-owner with Jeff. Steve's cell number is 360.631.3728", "foresters": [ { "id": 10, "firstName": "Kris", "lastName": "McCall", "abbreviation": "KM", "phoneNumbers": [], "emails": [] } ] }, { "id": 2, "limS_VendorId": "3b E", "name": "3B Excavators, LLC", "address1": "PO Box 12126", "address2": null, "city": "Salem", "state": "OR", "postalCode": "97302", "certificationRequired": true, "phones": [ { "id": 3, "phoneNum": "5033643821", "phoneType": 3 }, { "id": 4, "phoneNum": "(503) 362-1733", "phoneType": 1 } ], "insuranceContacts": [], "ein": "35-2331517", "stateNum": null, "ubiNum": "0", "workersCompNum": "6JUB-0G19574-4-16", "lAndINum": "0", "active": true, "professions": [ { "id": 8, "professionName": "Misc." } ], "certifications": [], "policies": [], "notes": "", "foresters": [ { "id": 12, "firstName": "Mark", "lastName": "Vroman", "abbreviation": "SMV", "phoneNumbers": [], "emails": [] } ] },
Hello Kenneth,
This error usually occur when you don’t register the control module within razor files at the time the page is initialized . So did you register DataGridModule in your application like this:
protected override void OnInitialized() { base.OnInitialized(); DataGridModule.Register(IgniteUIBlazor); }
You can also refer to this online help document for detail explaination about how to set up blazor application:www.infragistics.com/.../general-getting-started.html
I registered the control module exactly as you have listed above.
public partial class Contractors { [Inject] public ILimsDataService limsDataService { get; set; } [Inject] public NavigationManager navManager { get; set; } [Inject] public IIgniteUIBlazor IgniteUIBlazor { get; set; } public List<HmpContractor> HmpContractors { get; set; } = new List<HmpContractor>(); protected override void OnInitialized() { base.OnInitialized(); DataGridModule.Register(IgniteUIBlazor); } protected override async Task OnInitializedAsync() { HmpContractors = (await limsDataService.GetAllActiveContractors()).ToList(); } protected void AddNewContractor() { navManager.NavigateTo("ContractorDetails"); } protected void EditContractor(int id) { navManager.NavigateTo($"ContractorDetails/{id}"); } }
Thank you for the update. Right you did registered the DataGridModule and I am sure you have added igniteUI.Blazor package also from nugget.
Although working on my sample I am not able to reproduce the issue you described.I attached my sample here ,could you please modify the sample help reproducing the issue for further investigation or you can send the sample of your own which we can run and debug locally.
Thank you.
5582.BlazorDataGrid.zip
Nope. That wasn't it. I made the change and got the same error.
Hello,
Thank you for sharing the sample. Instead of having email communication I created a private case CAS-211828-Y3L2S3 to share the password and for further communication.
You can access this private case from your infragistics account at <https://ko.infragistics.com/my-account/support-activity>
Here's the password-protected zipped project. Please send me an email directly for the password at KenHaynes@HamptonLumber.com The file Contractors.json can be used to simulate the return from the call to the API for the grid.
Thank you for the update , though i do not have enough information to identify if the issue is in the application configuration or somewhere in the code.
We do support .net 5 also , you can verify that by changing the CLR in my application.
May be you can try isolating your sample , just have a grid with some column and bind with the dummy data and test if you can still reproduce the error or not. This will help you to narrow down the issue.
The best way for us to help you if you share your sample ,or modify mine which we can run and debug locally.
Regards,