Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
how to make a edit button in each row of jqgrid.

example

s.no name city address Edit

1 xxx xxx xxxx Edit

2 yyy yy yyy Edit

3 zzz zzz zzz Edit
.
.
.
.

how to do this? how to write code for this Edit event?

Thanks in advance
Posted

1 solution

Use custom formatter like below

C#
{ name: 'Edit',
                             formatter: function (cellvalue, options, rowObject) {
                                 var cellId = rowObject[0];//specify the index for getting the cell value

                              var x = '@Html.ActionLink("Edit", "Edit", "ControllerName", new { requestId = "myId" }, new { @style = "color:Blue;font-weight:bold;" })';
                                 return x.replace("myId",cellId);
                                 }
                             },sortable:false, align: 'left', width: 50
                         },


Your ActionResult

C#
public ActionResult Edit(int requestId)
{
return View();
}


Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900