Hi everyone.
I've got a grid on my razor page populated from a list of API-sourced records and none of the fields are displaying on there. I'm using local binding direct from an incoming model property...
@(
Html.Kendo().Grid(Model.AllAccounts)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(b => b.AccountId).Visible(false);
columns.Bound(b => b.AccountDescription).Title(Model.AccountDescriptionLabel);
columns.Bound(b => b.AccountHolder).Title(Model.AccountHolderLabel);
columns.Bound(b => b.ContractsCount ).Title("Total Contract(s)");
columns.Bound(b => b.ContactsCount).Title("Total Contact(s)");
columns.Bound(b => b.UsersCount).Title("Total User(s)");
columns.Command(command => command.Custom(Model.AccountDetailsButtonText).Click("showDetails"));
})
.Pageable()
.Sortable()
.Scrollable(scr=>scr.Height(430))
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(false)
.Events(events => events.Error("error_handler")
)
)
)
If I look at the records in debug then everything is populated, but the fields aren't showing on the grid row (Empty Grid Row.jpg).
I've got a button on the row linked to the record and if I intercept the dataitem in the script you can see that the camel case fields are populated but the pascal case ones aren't (which is definitely not the case when viewing records in debug!) (Data Item Grab.jpg).
I've followed the first two options in the guidance about the camel case issue from the JSON Serialisation Page but nothing is working for me (snippet of Program.cs follows).
// Add services to the container.
services.AddControllersWithViews()
.AddJsonOptions(options =>
options.JsonSerializerOptions.PropertyNamingPolicy = null);
Can anyone advise me what to do here? I've lost most of today on this issue.
Thanks for your time!