ASP.NET ID Property
Definition and Usage
The ID property gets or sets the programming identifier assigned to the server control.
Setting this property on the server control provides programmatic access to the properties, events, and methods of the server control. Web developers can set this property by declaring the ID attribute in the start tag of an ASP.NET server control.
If the ID attribute is not specified for the server control (either by declaration or programmatically), you can obtain a reference to the control through its parent control's Controls property.
Syntax
<asp:webcontrol id="id" runat="server" />
Example
This example demonstrates the button control with the ID attribute set:
<form runat="server"> <asp:Button id="button" text="Submit" runat="server" /> </form>
Example
- Button Control with ID Attribute Set