I am trying to use jQuery Grid plugin with ASP.NET MVC to display data. It seems examples provided on the web shows that the controller action signature looks like this:
public ActionResult SomeMethod(string sidx, string sord, int page, int rows) { }
Is there any way I can pass extra parameters from various input fields on the page?
Cheers, D.
ADDED: I have not written any code yet but the client side code will be something like:
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'/Entry/GridData/',
datatype: 'json',
mtype: 'POST',
colNames:['Entry Date','Registration','Registered Name'],
colModel :[
{name:'EntryDate', index:'EntryDate', width:40 },
{name:'Registration', index:'Registration', width:200 },
{name:'RegisteredName', index:'RegisteredName', width:200 }],
pager: jQuery('#pager'),
rowNum:20,
rowList:[5,10,20,50],
altRows: true,
sortable: false,
viewrecords: true,
caption: 'My first grid'
});
});
And the server side code something like:
public ActionResult GridData(string sidx, string sord, int page, int rows)
{
//Some stuff to get data, which needs a couple of extra parameters on top of the ones in the signature
return Json(dataCollection);
}
In the GridData action I need a couple more parameters to get the appropriate data. How do I specify these in the javascript, and how do I get hold of them in the controller action?