Hello Support, I am just trying to implement the Grid control for my application in dotnet core 6 and I wrote the following in the razor view:
The IndexDataSource action returns data, but for some reason, the gridview does not render the data and says No records to display. Please find below the code for the controller action:
public IActionResult IndexDataSource(DataManagerRequest dm) { IEnumerable DataSource =_db.VwDisplacementSas; var operation = new DataOperations(); var str = new List
Hi Adekunle,
Thanks for contacting Syncfusion support.
We have tried to reproduce the issue with .net6 core sample but the Grid is working fine at our side. Please refer to the below sample link for more information
https://www.syncfusion.com/downloads/support/directtrac/general/ze/GridUrlAdaptor1245795075
So could you share the below details that will be helpful for us to provide a better solution as early as possible?
We also discussed a similar scenario in the below thread. So, please have a look at this which may be related to your issue.
https://forumassist.syncfusion.com/172493
Regards,
Pavithra S
Hello Support,
Thanks for your help so far. I have bound the onActionFailure and it catches no errors.
Please find below the response from the datasource:
[
{
"iso3": "AGO",
"cntryName": "Angola",
"year": 2009,
"conflictStockDisplacement": null,
"conflictNewDisplacements": null,
"disasterNewDisplacements": 86000,
"disasterStockDisplacement": null,
"totalNewDisplacement": 86000,
"totalDisplacement": 0
},
{
"iso3": "AGO",
"cntryName": "Angola",
"year": 2010,
"conflictStockDisplacement": null,
"conflictNewDisplacements": null,
"disasterNewDisplacements": 79000,
"disasterStockDisplacement": null,
"totalNewDisplacement": 79000,
"totalDisplacement": 0
},
{
"iso3": "AGO",
"cntryName": "Angola",
"year": 2011,
"conflictStockDisplacement": null,
"conflictNewDisplacements": null,
"disasterNewDisplacements": 227000,
"disasterStockDisplacement": null,
"totalNewDisplacement": 227000,
"totalDisplacement": 0
},
{
"iso3": "AGO",
"cntryName": "Angola",
"year": 2012,
"conflictStockDisplacement": null,
"conflictNewDisplacements": null,
"disasterNewDisplacements": 6400,
"disasterStockDisplacement": null,
"totalNewDisplacement": 6400,
"totalDisplacement": 0
},
{
"iso3": "AGO",
"cntryName": "Angola",
"year": 2013,
"conflictStockDisplacement": null,
"conflictNewDisplacements": null,
"disasterNewDisplacements": 2500,
"disasterStockDisplacement": null,
"totalNewDisplacement": 2500,
"totalDisplacement": 0
},
{
"iso3": "AGO",
"cntryName": "Angola",
"year": 2015,
"conflictStockDisplacement": null,
"conflictNewDisplacements": null,
"disasterNewDisplacements": 5600,
"disasterStockDisplacement": null,
"totalNewDisplacement": 5600,
"totalDisplacement": 0
},
{
"iso3": "AGO",
"cntryName": "Angola",
"year": 2016,
"conflictStockDisplacement": null,
"conflictNewDisplacements": null,
"disasterNewDisplacements": 19000,
"disasterStockDisplacement": null,
"totalNewDisplacement": 19000,
"totalDisplacement": 0
},
{
"iso3": "AGO",
"cntryName": "Angola",
"year": 2017,
"conflictStockDisplacement": null,
"conflictNewDisplacements": null,
"disasterNewDisplacements": 14000,
"disasterStockDisplacement": null,
"totalNewDisplacement": 14000,
"totalDisplacement": 0
}
]
Hi Adekunle,
Thanks for sharing the details.
For data binding with the “UrlAdaptor” the Grid expects the response as “result” and “count” pair. From your update, it seems only the JSON value is returned which might be the cause of the issue. For further validation, we need some more details to check why the “dm.RequiresCount?” condition failed in your server. So, could you please share the below details that will be helpful?
Regards,
Pavithra S
Thanks a lot for your help, this was definitely the case. It works now
Hi Adekunle,
It is great to hear that the provided information helps you.
Please get back to us if you need further assistance.
Regards,
Pavithra S