Thursday, March 22, 2012

Passing ASP.NET control value to JavaScript variable

We can't use ASP.NET control's original ID in order to pass its value to a client-side code (i.e. var my_js_var = document.getElementById('my_aspnet_textbox').value;

Which means we have to use the following code in order to perform our task:

var my_js_var = document.getElementById('<%=my_aspnet_textbox.ClientID%>').value;

No comments:

Post a Comment