1. How to access server control value in Page
We can use
var input = document.getElementById('<%=txtValue1.ClientID %>');Syntax to access server side controls in the client side. However
Please refer this article for more information
2. How to access server control values in UserControl or WebControl
In this case we have to hold the script in a string variable and inject necessary ClientIDs in the run time. Then use this.Page.RegisterClientScriptBlock(...) method to register the script by the render time.
this.Page.ClientScript.RegisterClientScriptBlock( this.GetType(), this.GetType().Name, string.Format(this.script, this.txtValue1.ClientID, this.txtValue2.ClientID, this.txtValue3.ClientID), true);Please refer this article for more information
Wednesday, August 25, 2010
How to access values of server controls in client side
‘How to access values of server controls in client side’ is a frequently asked question in asp.net developer community. Technically solution to the question can be sub divided in to two simple answers.
iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5 2208 X 1242 iPho...
<% @ Page Language = "C#" %> < html > < head id = "Head1" runat = "server" > ...