asp.net - Passing a JavaScript variable to a helper method -


i using asp.net mvc 3 , yui library.

i created own helper method redirect edit view passing in item's id model such:

window.location = '@url.routeurl(url.newsedit(@model.newsid))'; 

now busy populating yui data table , call helper method above, not sure if possible because item's id javascript like:

var formatactionlinks = function (ocell, orecord, ocolumn, odata) {    var newsid = orecord.getdata('newsid');    ocell.innerhtml = '<a href="/news/edit/' + newsid + '">edit</a>'; }; 

store url custom id, you'll replace later on:

var myurl = '@url.routeurl(url.newsedit(0))'; //let's use 0 

later on:

var formatactionlinks = function (ocell, orecord, ocolumn, odata) {    var newsid = orecord.getdata('newsid');    //lets use url defined above, , replace 0 our id.    ocell.innerhtml = '<a href="' + myurl.replace('0',newsid)+ '">edit</a>';  }; 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -