How to get an rows cell value from JQGrid to Controller Action method

Posted by ramuvalmiki07-22001 under ASP.NET on 6/3/2013 | Points: 10 | Views : 1343 | Status : [Member] | Replies : 0
Hii to all,
I have a requirement that i need to get an two tables data from DataBase & display in JQGrid,i have done this using EntityFramework & LINQ in MVC3,here i have one more requirement that where iam facing problem,in addition to the table data i need to display one more column with ActionLinks,whenever user click on ActionLink the respective columns ID(i.e respective rows cell data) i need to get in the controller.This is how i tried by writing my JQGrid code to meet my requirement.
Collapse | Copy Code

$("#emp-data-grid").jqGrid({
datatype: "local",
data: mdata,
colNames: ["EmployeeID", "EmpName", "Designation", "Salary", "MobileNo", "Email", ""],
colModel: [
{ name: "EmployeeID", index: "EmployeeID", sortable: false,
editable: true, edittype: 'checkbox', editoptions: { value: 'true:false' }
},
{ name: "EmpName", index: "EmpName" },
{ name: "Designation", index: "Designation" },
{ name: "Salary", index: "Salary", sorttype: "int" },
{ name: "MobileNo", index: "MobileNo", sorttype: "int" },
{ name: "Email", index: "Email" },

{name: 'Link', formatter: function (cellvalue, options, rowObject) {
Collapse | Copy Code

var x = '@Html.ActionLink("EDIT", "Edit", "Home", new { EmployeeID = "id" }, new { @style = "color:Blue;font-weight:bold;" })';
return x.replace("id", rowObject[1]);
}, align: 'left', width: 100,editurl: ' / Home / Edit / '
}
],

shrinkToFit: true,
viewrecords: true,
sortorder: 'asc'
caption: "Employee List"
});
This is my Controller Code:-
public ActionResult Edit(int? id)
{
return view();
}
In the above controller i want to access id and send to view for displaying that id in some textbox,using viewdata. Please guide me where iam doing mistake,...
Thanks
Ramu




Responses

(No response found.)

Login to post response