ASP.NET IDProperty


控件标准属性参考手册Control Standard Properties Reference

Definition and Usage

The ID property gets or sets the programming identifier assigned to the control.

This property is usually set and used when the current control interacts with other controls or scripts. Setting this property on the control provides programmatic access to the control's properties, events, and methods. Web developers can set this property by declaring the ID attribute in the opening tag of an ASP.NET control. If the property is not specified for the control (either declaratively or programmatically), a reference to the control can be obtained through the Controls property of its parent control.

Syntax

<asp:webcontrol id="id" runat="server" />


Example

The following example shows a Button control with the ID property set:

<form runat="server">
<asp:Button id="button" text="Submit" runat="server" />
</form>

Try it Yourself »

控件标准属性参考手册Control Standard Properties Reference Other Extensions