asp.net.ph

Control.ID Property

System.Web.UI Namespace   Control Class


Sets or retrieves the programmatic identifier assigned to the server control.

Syntax


Inline <asp:control ID = [ strID ]... >
Script Control.ID = [ strID ]

Property Value

The programmatic identifier assigned to the control.

Remarks

Setting this property on a server control provides programmatic access to the server control's properties, methods, and events. This property can be set by declaring an id attribute in the opening tag of an ASP.NET server control.

If this property is not specified for a server control, either declaratively or programmatically, you can obtain a reference to the control through its parent control's Controls property.

NOTE: Including spaces in this property will cause an ASP.NET page parser error.

Example

The following illustrates how the ID property can be used to determine which of a form's controls have been selected, the value of which is then used for further processing.

void getBook ( object src, EventArgs e ) {
   string id = ( ( HtmlButton ) src ).ID;
   book.KeywordFilter = id;
   book.Visible = true;
   ...
}

 Show me 

See Also

Control Members   Control.NamingContainer   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