Я пытаюсь реализовать jquerygrid плагин в моем приложении asp.net mvc4. Но им застрял. Нужна ваша помощь. Написал весь код, и я получил только белую страницу с данными json. Я не знаю, почему.Asp.net mvc4 jqueryGrid не отображается
Мой взгляд показано ниже:
@model Fancy.Management.Model.User.IndexModel
@{
ViewBag.Title = "Index";
}
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'@Html.Action("Index","User")',
datatype: 'json',
mtype: 'GET',
colNames:['Id','Votes','Title'],
colModel :[
{name:'Id', index:'Id', width:40, align:'left' },
{name:'Votes', index:'Votes', width:40, align:'left' },
{name:'Title', index:'Title', width:200, align:'left'}],
pager: jQuery('#pager'),
rowNum:10,
rowList:[5,10,20,50],
sortname: 'Id',
sortorder: "desc",
viewrecords: true,
imgpath: '/scripts/themes/coffee/images',
caption: 'My first grid'
});
});
</script>
<table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
<div id="pager" class="scroll" style="text-align:center;"></div>
И мой метод действия показан ниже:
public ActionResult Index(string sidx, string sord, int? page, int? rows)
{
var jsonData = new
{
total = 1,
page = 1,
records = 3,
rows = new[]{
new{Id=1,cell=new[] {"1","-7","Is this good question?"}},
new{Id=2,cell=new[] {"2","15","Is this really?"}},
new{Id=3,cell=new[] {"3","23","Why is the sky blue?"}}
}
};
return Json(jsonData, JsonRequestBehavior.AllowGet);
}
Exception, что я получил показано ниже:
Спасибо Давид проблема решена – fuat