asp.net mvc 3 - Changing <a href> dynamically in jquery Teleric grid MVC3 -


hello working on teleric grid in mvc3

i want change href of "a" tag dynamically

below code

 function onrowdatabound(e) {      if (e.dataitem.affiliateid == 1) {        var id=e.dataitem.id;    e.row.cells[0].innerhtml ="<a href=\"@url.content("~/customer/address/list/"+id)\"  target=_blank>nxn v</a>";          e.row.cells[0].style["color"] = "red";     } 

but error id not exist in current context

any solutions?

the url.content() call executed @ time view parsed , sent browser. javascript executed when grid renders in browser (much later).

all this

@url.content("~/customer/address/list/"+id) 

is c#-code. cannot access javascript variables in c# code or vice versa.

what need generate url without id , concatenate in javascript:

e.row.cells[0].innerhtml ="<a href=\"@url.content("~/customer/address/list/")"+ id +"\"  target=_blank>nxn v</a>"; 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -