Forum


10:38

14/09/2009

Hi,
I am newbie to JqGrid. I am using Asp.net MVC with JqGrid. I have a details page which navigated from the index page.
<%= Html.ActionLink(item.MoMID.ToString(), "Details", new { id = item.MoMID })%>
Here is the details method in the controller.
public ActionResult Details(int id)
{
var db = new DashBoard.Context.DB();
return View(db.MoMs.SingleOrDefault(m => m.MoMID == id));
}
I have a Jqgrid declared in my details.aspx page as follows.
$(document).ready(
function() {
jQuery("#gridMins").jqGrid({
url: 'Minutes',
datatype: 'json',
mtype: 'GET',
colNames: ['SNo', 'Description'],
colModel: [
{ name: 'SNo', index: 'SNo', width: 50 },
{ name: 'Description', index: 'Description', width: 600 }
],
sortname: 'SNo',
sortorder: 'asc',
viewrecords: true,
caption: 'Minutes'
});
});
Here is the table element
<table id="gridMins"></table>
Minutes method for the jqGrid is as follows.
public ActionResult Minutes(string sidx, string sord, int page, int rows)
{
DashBoard.Context.DB db = new DashBoard.Context.DB();
var jsonData = new
{
total = 1,
page = page,
records = db.MoMMinutes.ToList<MoMMinute>().Count,
rows = (
from mom in db.MoMMinutes
select new
{
i = mom.SNo,
cell = new string[] {mom.SNo.ToString()
, mom.Description.ToString()}
}).ToArray()
};
return Json(jsonData);
}
Most Users Ever Online: 715
Currently Online:
49 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66