1
Vote

how to bind JSON data to MVC Contrib Grid

description

I can provide the column names and then provide the data in a JSON format. Is there a way to bind JSON data to MVC Contrib Grid?.

Kindly update this issue at the earliest.

comments

JeremyS wrote Aug 14, 2011 at 9:35 AM

The MvcContrib grid works by rendering a table based on strongly-typed objects - it does not work with JSON data directly. You would need to deserialize the JSON into strongly-typed objects before using it with the grid.

saravanand wrote Aug 16, 2011 at 11:30 AM

Hi Jeremy,
When i deserialize JSON to a dynamic object how can i bind the properties to the grid. Also note that i will have to deal with a varying number of columns each time i call the grid to render content. Further to this is it possible for me to bind a ADO.NET datatable datasource to the grid. If so give me some more detailed directions on how to go ahead with the implementation.
Thank you for your time.

saravanand wrote Aug 16, 2011 at 1:31 PM

Hi Jeremy,
Kindly note that i have tested by providing the dataTable.AsEnumerable() as an IEnumerable Datasource, but not able to get the output. Any ideas on how to proceed in this direction?.

JeremyS wrote Aug 16, 2011 at 5:34 PM

saravanand, it really sounds like the mvccontrib grid isn't appropriate for your situation. It is only designed to work with strongly-typed objects with a fixed number of columns - not dynamic objects and not datatables. If you need something more dynamic then you'd be better off looking at an alternative solution.