Last post Jan 18, 2011 09:05 PM by Bober Song - MSFT
Jan 15, 2011 09:39 PM|bhsstudio|LINK
Hi everyone, I am wondering if jsonResult method can be used to return Data Table? If so, is it a json array or a json string? Thanks
Jan 16, 2011 04:45 AM|ignatandrei|LINK
it is an object with his methods.You can call safely his method / properties.
Jan 16, 2011 02:49 PM|bhsstudio|LINK
Well, I got this error message
Here is my code, it is really simple.
public JsonResult testData()
DataTable xTable = xFunction.GetAllCategories();
return Json(xTable, JsonRequestBehavior.AllowGet);
And I try to visit this action directly from web browser. It looks like this, http://localhost:57733/Admin/testData
the Admin is the controllers name, and testData is the action name. Did I do anything wrong?
Jan 16, 2011 03:11 PM|raduenuca|LINK
here is a sample:
I suggest you download the asp.net mvc 2 or 3 source code and have a look at the:
JsonResult.cs and Controller.cs in order to have an ideea how they work and how to override them in order to add a DataTableToJsonResult class
it seems that is does not support ADO.NET object directly and you have to build a custom converter (provided in the sample)
Jan 16, 2011 03:13 PM|ignatandrei|LINK
I do not think that DataTable does have 'System.Reflection.RuntimeModule'.
Do you use NHibernate ? What kind of data did you put in
Jan 16, 2011 11:57 PM|imran_ku07|LINK
Convert DataTable to IEnumerable(and then call ToList method) using
AsEnumerable extension method.
Jan 18, 2011 09:05 PM|Bober Song - MSFT|LINK
Hi bhsstudio ,
For detail, please check the following link.
I hope it is helpful to you.