Hi Erik,
Greetings from Syncfusion support.
We checked the reported problem in the attached sample and would like to let you know that it was occurring due to the serialization problem in the ASP.NET Core where it returns the JSON results in camelCase format by default, because of which your newly added data source field names were returned in camelCase as ‘code’ and ‘description’ whereas the columns fields are set as ‘Code’ and ‘Description’. The column field names are case-sensitive and since the names do not match, the added value was not getting displayed in the Grid.
You can resolve this problem by serializing and returning them in the PascelCase format using the below approach,
If the ASP.NET CORE version is 2.X then add the below code in startup.cs file
|
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddJsonOptions(options =>
{
options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();
});
} |
If the ASP.NET CORE version is 3.X then add the below code in startup.cs file
|
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddNewtonsoftJson(options =>
{
options.SerializerSettings.ContractResolver = new DefaultContractResolver(); });
} |
Please check the below documentation link for more details on this,
Also, the Grid Editing feature requires a primary key column for performing the CRUD operations. To define the primary key, set isPrimaryKey property of e-grid-column tag helper as true in particular column. More details on this can be checked in the below documentation link,
We have modified the shared sample based on this for your reference. You can find it below,
Note: Since you had used your own db connection for fetching data, we had set local data in the above Grid sample.
Please get back to us if you require any further assistance.
Regards,
Sujith R