I followed the steps in
datagrid / how-to / client-side-using-visual-studio /
And I added a very simple grid to my test project (all very simple).
Just to avoid any 'contamination', I create the list of local orders to visualize them, so I just ended up with this code:
Where in the code I simply have:
public class Order
{
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public DateTime? OrderDate { get; set; }
public double? Freight { get; set; }
}
public List Orders { get; set; }
protected override void OnInitialized()
{
Orders = Enumerable.Range(1, 75).Select(x => new Order()
{
OrderID = 1000 + x,
CustomerID = (new string[] { "ALFKI", "ANANTR", "ANTON", "BLONP", "BOLID" })[new Random().Next(5)],
Freight = 2.1 * x,
OrderDate = DateTime.Now.AddDays(-x),
}).ToList();
}
But whatever I try, I always get this error:
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Cannot read property 'querySelector' of null
TypeError: Cannot read property 'querySelector' of null
(I had to remove the rest of the error because it contains urls that cannot be inserted in this message...)
...and I cannot even imagine what it can be... :-(
Could anyone help, please?
Thank you in advance.
Andrea