我最难从我的 url 中提取数据并将其放入我在 asp.net MVC4 中的 jqGrid 中。我在这里想念什么?
$(document).ready(function () {
jQuery("#frTable").jqGrid ({
cmTemplate: { sortable: false },
caption: '@TempData["POPNAME"]' + ' Population',
url: '@Url.Action("GetAjaxPagedGridData", "Encounters", new { popId = TempData["POPULATIONID"] })',//'/Encounters/GetAjaxPagedGridData/'+ '',
datatype: "jsonstring",
mtype: 'GET',
pager: '#pager',
height: '450',
...
然后你进入 colNames 和 colModels 以及所有与这个特定查询相切的东西。这是返回我的数据的方法。我只想说我做客户端分页的东西似乎有效。但除非我能真正看到数据,否则我无法验证?
我在这里做错了什么?
public string GetAjaxPagedGridData(int page, int rows, int popId) {
string userID = HttpContext.User.Identity.Name;
DataRepository dr = new DataRepository();
string encounter = dr.Get(popId, userID, "1", page, rows, "");
return encounter;
}