Tuesday, October 21, 2008
In case of HTML control in your web page:
< input type="text" id="txtName" />
you can access this value as document.getElementById('txtName').value;
Suppose you have a Web server control like TextBox in your Web page:
< asp:TextBox id="Test" Text="Sample" runat="server">
ClientID - server control identifier generated by ASP.NET
You should use ClientId for accessing Server control always especially when we have Master Pages or the control is inside of other server controls like Panel, Gridview etc. As in all these cases server generates ClientId dynamically and which will vary time to time or in some browser instances.
Also Read other Top Articles
- JSON Serialization in VS 2008
- Implementing Forms Authentication in Silverlight Application.
- Making GridView Rows or Individual Cells Clickable and Selectable.
- Enabling browser back button for GridView Paging and Sorting in Ajax 1.1 and 3.5 (using Visual Studio 2005/ Visual studio 2008)
- How to pass values from User Control to Page or calling Page methods from User Control.
- What is WCF?
- New features in C# 4.0
- C# to VB.NET and VB.NET to C# online free converter tools.