i am using jquery grid in MVC 3 .as a formatter option i am using following code as a script segment.
function viewformateadorLink(cellvalue, options, rowObject) {
return "<a href=../xxx/yyy/Edit/" + rowObject[0] + ">" + cellvalue + "</a>";
}
but i don’t want to use href here .better option i have found is as follows:
func....(){
var url = '@Html.ActionLink( "_name_", "Edit", new { id = "_id_" })';
url = url.replace(/_name_/, cellvalue);
url = url.replace(/_id_/, rowObject[0]);
return url;
}
are there any simple way exist for passing parameter?
If the value you want to pass to the link is in a JavaScript variable and you don’t want to use href, then I’m afraid you can’t go further than you already have gone and this is why:
The JavaScript code is ALWAYS executed after the server-side code.
I imagine you would like to do something like:
but due to the reason I mentioned above, such thing is impossible.
I would suggest you stick to any of the other methods you used in your question.