TAGS :Viewed: 6 - Published at: a few seconds ago

[ Call Controller's Action in MVC through jqgrid ]

I create the Button in jqgrid row by using the Formatter.

Now I try to call the Controller's Action method by the following way,


name: 'Save', index: 'Save', width: 100, sortable: false,

formatter: function (cellvalue, options, rowObject) {

return "input type='button' value='store' onclick=location.href=@Url.Action("Action", "Controller") ";



But,I cant able to call the action.How to solve This?

Answer 1

Change :

onclick=location.href=@Url.Action("Action", "Controller")

to this:

onclick=location.href='@Url.Action("Action", "Controller")'