Is it possible?
@Html.ActionLink( "Link text", "Action Name", new { id = *JAVASCRIPT VARIABLE* })
Please explain with example code.
Is it possible?
@Html.ActionLink( "Link text", "Action Name", new { id = *JAVASCRIPT VARIABLE* })
Please explain with example code.
It actually is very much possible with the following:
var hello = "Great Job!";
var text = "@Html.ActionLink( "Link text", "Action Name", new { id = "JSVar" })"
text = text.replace("JSVar",hello);
As easy as that! :)
All the @Html.Action link does is create a url string so doing replace on it is the same as replace on any javascript string
var text = "@Html.ActionLink( "Link text", "Action Name", new { id = "{0}" })"; not sure if the {0} will work in that helper, but you get my drift