Sample project does not display data


I downloaded the sample project (jqMvcGrid and jqMvcGrid(NotCompleted) ). When I run it from VS 2010, I get few issues.
1) I see no data in the grid for Categories and Products, although those tables has data in Northwind database file.
2) I get javascript error when I click on "Create New" link.
Line: 11
Error: Unable to get value of the property 'defaults': object is null or undefined
Please help!


chiragbhagat wrote Jul 24, 2012 at 4:44 PM

Guys, any progress on this fix?

wrote Oct 18, 2012 at 7:06 AM

BartVDA wrote Oct 18, 2012 at 7:18 AM

One issue can be solved by adding 'JsonRequestBehavior.AllowGet' in the JSONDataController, function list:

public ActionResult List(int page, int rows, string sidx, string sord)
return Json(model.ToJqGridData(page, rows, null, "", new[] { "ProductName", "UnitPrice" }), JsonRequestBehavior.AllowGet);

chiragbhagat wrote Oct 19, 2012 at 3:38 PM

Thanks a lot, BartVDA! I was able to get the data in the grid now.

However, when I click on Edit and View button, I get following Javascript error.

Line: 11
Error: '$.jgrid' is null or not an object

Please help!

chiragbhagat wrote Oct 19, 2012 at 7:08 PM

Just fixed this issue:

Removed following script reference from Site.Master page,
script language="javascript" type="text/javascript" src="<%= Url.Content("~/Scripts/Site.Master.js"

FYI, reference to this script is not required in Create/Edit/View pages which is throwing javascript error.

I moved this script reference in Index pages for Products and Categories pages, and it worked!

wrote Feb 21, 2013 at 10:30 PM