Hi - we're trying to implement the DataGrid and DataGridColumns to dynamically display results returned from a SQL query. Since a query could be against any of a large number of tables (no model classes), we generically store the column definitions in their own list, and the table of results as a list of object arrays.
Here's a snippet:
<RadzenDataGrid AllowFiltering="true" FilterMode="FilterMode.Advanced" AllowPaging="true" PageSize="25" AllowSorting="true" Data="@this.fullQueryResults" TItem="object[]" IsLoading="@this.runningQuery" Count="@this.fullQueryResults.Count">
<Columns>
@for (int i = 0; i < this.dbColumns.Count; i++)
{
<RadzenDataGridColumn TItem="object[]" Title="@this.dbColumns[i].Name" Type="@DatabaseHelper.GetClrType(this.dbColumns[i].DataType)">
<Template>
@context[i].ToString()
</Template>
</RadzenDataGridColumn>
}
</Columns>
</RadzenDataGrid>
But it's running into a runtime error when we try to display the results:
Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Radzen.PropertyAccess.IsNumeric(Type source)
at Radzen.Blazor.RadzenDataGrid`1.BuildRenderTree(RenderTreeBuilder __builder)
My assumption is that the RadzenDataGridColumn element is missing the 'Property' property. However, I'm not sure what the solution would be to work around this, since we don't have any specific property names we're accessing, rather the ToString() representation of the object itself.