When I use editurl property in my jqgrid, the controller action gets called after I hit submit button on adding a new row. But how do I get all the grid rows there? Which parameter should I read from my controller action method in order to get the grid data?
Grid code:
$("#list1").jqGrid({
url: '/CMS/GetCustomLanguageData',
---
---
editurl: '/CMS/SaveCustomLanguageData'
---
Add new row code:
grid.jqGrid('editGridRow',"new",{height:280,reloadAfterSubmit:false,addCaption: "Add Record",
editCaption: "Edit Record",
bSubmit: "Submit",
bCancel: "Cancel",
bClose: "Close",
saveData: "Data has been changed! Save changes?",
bYes : "Yes",
bNo : "No"
});
Controller code:
public ActionResult SaveCustomLanguageData()
{
}
jqGrid send to the controller named parameters with the name as you defined in the 'name' property of the
colModel
. Additionally will be sendoper=add
andid=_empty
. So your controller action can look like followingon the client side you should decode the JSON response for example with the following code