tags:

views:

41

answers:

1

I have an ActionResult in my HomeController defined to return JSON. The JSON is used in my View to render a jqGrid. This works perfectly. In addition to the JSON being returned, I need to also return other data (i.e. a decimal value that is not part of the JSON). What are ways I can do this? I am fairly new to MVC. Thanks for any help provided.

This is my return statement in my ActionResult:
return Json(jsonData, JsonRequestBehavior.AllowGet);

+1  A: 

Return a composite class that contains your grid data and any other data. then you can interegate the json object on the client.

at least that's how i'd do it.

griegs
Is there another way to do this other than a composite class? I ask because in my View I simply have a Script tag that reads the JSON to render the jqGrid. I am not sure how I would read a composite class to extract data used in Javascript and the other value I need displayed in the view. Are there any examples that can help me? Thanks again...
obautista
I think if you have a class that has say two properties, that you can extract them using the property name in json. There's some information here http://www.hunlock.com/blogs/Mastering_JSON_%28_JavaScript_Object_Notation_%29 that shows you ways of getting an object and its properties.
griegs