public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().AddNewtonsoftJson();
services.AddMvc().AddNewtonsoftJson(options => {
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
});
………………………………….
} |
Hi Edi Torabi,
Thanks for contacting Syncfusion forums.
Query: “n hosted core blazor data is taken from the database but in the grid. Of course, in your example , the data is displayed, but the next two example will not be displayed.”
From your query we understand that you are facing issue while binding the dataSource to Grid from WebAPI controller. We have prepared a sample as per your suggestion and we are not able to reproduce the reported issue at our end. But you have mentioned that Data is not displayed in Grid.
We suspect that blank rows are rendered in Grid due to camel case issue. This issue occurred when serializing the return values. For WebAPI Adaptor data must be retuned in form of Items and Count. But in Asp.NetCore while serializing it gets converted into items and count. This may be the cause of an issue. If you are facing above issue, kindly include the below code example in your startup.cs file.
public void ConfigureServices(IServiceCollection services){services.AddMvc().AddNewtonsoftJson();services.AddMvc().AddNewtonsoftJson(options => {options.SerializerSettings.ContractResolver = new DefaultContractResolver();});
………………………………….}
For your convenience we have attached the sample which can be downloaded from below
Sample: https://www.syncfusion.com/downloads/support/directtrac/145880/ze/EFGrid_-_CRUD_-_P61253481616
After try out the above solution, if you are still facing the issue kindly share the following details.
- Share the screenshot of network tab, how the dataSource is returned from webAPI?.
- Screenshot of script error in console with full tack trace (if any).
- If possible try to reproduce the reported issue at our end.
For the Third Grid, you have used Json Adaptor to bind the dataSource as local data from WebAPI controller. Can you please share the following details along with above details.
- Share the GetAll() method in controller along with its return type. Because while binding local data, entire dataSource must be returned to Grid.
- If you are facing any script error in console. Kindly share the screenshot of the issue.
Requested details will be helpful for us to validate the reported issue at our end and provide the solution as soon as possible.
Regards,Vignesh Natarajan.
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<OutputType>Exe</OutputType>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
<BlazorLinkOnBuild>False</BlazorLinkOnBuild>
</PropertyGroup> |