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.
Subscribe to:
Post Comments (Atom)
Azure Storage Account Types
Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...
-
Why we need asynchronous tasks? Execute a time consuming operations in parallel to the CLR thread which execute the request If you have ...
-
Demo: I was thinking a way to show images before actually uploading them to server. I would say to preview images using javascript. Obv...
No comments:
Post a Comment