asp.net.ph

Control.ClientID Property

System.Web.UI Namespace   Control Class


Returns the server control identifier generated by ASP.NET.

Syntax


Script Control.ClientID

This property can only be used programmatically; it cannot be set when declaring the control.

Property Value

The server control identifier generated by ASP.NET.

Remarks

ASP.NET automatically generates a ClientID for a server control regardless of whether you have specified an ID property for it or not. This property is used to identify a control for client-side operations, such as ECMAScript functions.

Any name you assign to a server control using the ID property overrides the value of this property.

Example

The following example retrieves the ClientID property of each control in a given Controls collection.

void Page_Load ( object src, EventArgs e ) {
   // Get the list of all controls.
   IEnumerator myEnumerator = Controls.GetEnumerator ( );

   while ( myEnumerator.MoveNext ( ) ) {
      Control myControl = ( Control ) myEnumerator.Current;
      // Display the ClientID property 
      Response.Write ( myControl.ClientID + "<br>" );
   }
}
  C# VB

See Also

Control Members   NamingContainer   ID   INamingContainer Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph