We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Empty grid with urladaptor

Thread ID:





141644 Dec 24,2018 07:10 AM UTC Apr 15,2019 09:20 AM UTC ASP.NET Core - EJ 2 3
Tags: DataGrid
Bernard Jurlina
Asked On December 24, 2018 07:10 AM UTC

Why is my grid empty when using urladaptor like this?

public IActionResult GridDatasource([FromBody]DataManagerRequest dm)
            var dsRacuni = from r in _context.FirmaRacun
                           where r.FirmaId == 13
                           select r;

            IEnumerable<FirmaRacun> DataSource = dsRacuni.AsEnumerable();

            DataOperations operation = new DataOperations();
            if (dm.Search != null && dm.Search.Count > 0)
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
                DataSource = operation.PerformSorting(DataSource, dm.Sorted);
            if (dm.Where != null && dm.Where.Count > 0) //Filtering
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
            int count = DataSource.Cast<FirmaRacun>().Count();
            if (dm.Skip != 0)
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging
            if (dm.Take != 0)
                DataSource = operation.PerformTake(DataSource, dm.Take);
            return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);

<ejs-grid id="Grid" locale="hr-HR" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })">
                            <e-data-manager url="/Maticni/Firmas/GridDatasource" updateUrl="/Maticni/Firmas/NormalUpdate" adaptor="UrlAdaptor"></e-data-manager>
                            <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
                                <e-grid-column field="RacunId" isPrimaryKey="true" headerText="RacunId" width="50"></e-grid-column>
                                <e-grid-column field="FirmaId" headerText="FirmaId" width="50"></e-grid-column>
                                <e-grid-column field="BankaId" headerText="Banka" foreignKeyValue="Naziv" dataSource="ViewBag.dsBanka" validationRules="@(new { required=true})" width="50"></e-grid-column>
                                <e-grid-column field="Iban" headerText="IBAN" validationRules="@(new { required=true})" width="50"></e-grid-column>
                                <e-grid-column field="IntBrojFirme" headerText="Int. br." width="50"></e-grid-column>
                                <e-grid-column field="Aktivan" editType="booleanedit" displayAsCheckBox="true" type="boolean" headerText="Aktivan" width="50"></e-grid-column>


Pavithra Subramaniyam [Syncfusion]
Replied On December 26, 2018 04:30 AM UTC

Hi Bernard, 
Thanks for contacting Syncfusion support. 
To render the Grid data, column’s field names and the property name in the data source should be same. After that Grid will be rendered with data. Due to serialization problem, your datasource field name is changed to camel case(firmaId) and so there is a mismatch in the column’s field which is in pascal case(FirmaId). This is why you don’t have data in Grid.  
To overcome this serialization problem, we suggest you to add the JsonOutputFormatter options under the Startup.cs file. JsonOutputFormatter is a TextOutputFormatter for JSON content. Please refer the sample below, 
public void ConfigureServices(IServiceCollection services) 
            // Add framework services. 
            services.AddMvc().AddJsonOptions(options => 
                options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver(); 
Please get back to us if you need further assistance. 
Pavithra S. 

Normand Bellemare
Replied On April 11, 2019 08:48 AM UTC

Hi guys,

unfortunately, we have been facing this problem for a few days now. We also tested the solution here (above). Works well so far. Unfortunately (again) we use another framework on the server side and there the part does not work, which is responsible for Anti-Forgery, among others.
Unfortunately, at the moment we only see 2 very complex solutions:
1. For each class that is serialized as Json, set a Json property name attribute.
2. For any json serialization that requires lowerCamelCase (or whatever you want to call it), explicitly specify the ContractResolver in the serialization-settings.
But as I said: that is both very expensive.
Isn't there any way to configure Syncfusion to accept and handle UpperCamelCase (or PascalCase)?

Thanks a lot in advance for a useful hint.


Pavithra Subramaniyam [Syncfusion]
Replied On April 15, 2019 09:20 AM UTC

Hi Normand, 
Thanks for your update. 
We have validated your query and this problem is the default case for ASP.Net Core behavior not related to Syncfusion. While using remote data, the Pascal case is converted into camelCase. To solve this, we need to add ContractResolver in StartUp.cs file. Please refer the below links for your reference. 

We have prepared a sample based on your requirement with Anti-Forgery token. You can add Anti-Forgery token in Startup.cs file as like below code example. Please find the below code example and sample for your reference. 

public void ConfigureServices(IServiceCollection services) 
            services.AddMvc().AddJsonOptions(x => { 
                x.SerializerSettings.ContractResolver = new DefaultContractResolver(); 
            services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN"); 
<ejs-grid id="Grid" allowPaging="true" load="onLoad" actionComplete="actionComplete" toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel"})"> 
    <e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Dialog" template="#dialogtemplate"></e-grid-editSettings> 
    <e-data-manager url="/Index?handler=DataSource" insertUrl="/Index?handler=Insert" updateUrl="/Index?handler=Update" removeUrl="/Index?handler=Delete"  adaptor="UrlAdaptor"></e-data-manager> 
Please get back to us if you need further assistance. 
Pavithra S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon