System.Web.UI Namespace Control Class
Sets or retrieves the programmatic identifier assigned to the server control.
Inline |
<asp:control ID = [ strID ]... > |
Script |
Control.ID = [ strID ] |
The programmatic identifier assigned to the control.
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.
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
Control Members Control.NamingContainer INamingContainer