开发者

jQuery Grid for MVC data not coming from controller to view

I just downloaded jQuery Grid for ASP.NET MVC from codeplex

I did run the project, all seams to be all right, in Sql Profiler i can see that sql queries coming to database. Then in debugger i can see that data comes in LinqToSql query fine:

var model = from entity in repository.Index().OrderBy(sidx + " " + sord)
    select new
    {
        Edit = "_edit link was here_",
        Details = "_details link was here_",
        ProductID = entity.ProductID,
        ProductName = entity.ProductName,
        UnitPrice = entity.UnitPrice,
        Discontinued = entity.Discontinued == true 
            ? "<input type='checkbox' checked='checked' disabled='disabled'/>" 
            : "<input type='checkbox' disabled='disabled' />"
    };

Data coming to model, model is not null.

Then this data converting in to JSON and then JsonResult go in to view:

JsonResult jData = Json(model.ToJqGridData
    (page, rows, null, search, new[] { "ProductName" }));
return jData;

i saw in debugger, there is data in jData, jData is not null, all looking good.

But then on the view (html) there is no data displaying on the jqGrid, it is empty. For some reasons data not coming from controller to view(jqGrid). I was trying all latest browsers.

I think the problem hiding somewhere in javascripts, currently i am looking in to this.

Ma开发者_运维问答y be some one have any ideas about that.


You have to add 'JsonRequestBehavior.AllowGet' the following in JSonDataController, function List:

return Json(model.ToJqGridData(page, rows, null, "", 
            new[] { "ProductName", "UnitPrice" }), JsonRequestBehavior.AllowGet);


It is not my javascript :) http://jqmvcgrid.codeplex.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜