ASP.NET DefaultButton Property

Definition and Usage

The DefaultButton property is used to set or return the ID of the default button of the Panel control.

Use the DefaultButton property to indicate which button will be clicked when the Panel control has focus and the user presses the Enter key.

Syntax

<asp:Panel DefaultButton="button_id" runat="server">
Some Content
</asp:Panel>
Property Description
button_id The id of the button to be used as the default button.

Example

The following example sets the DefaultButton for the Panel control:

<form runat="server">
<asp:Panel runat="server" DefaultButton="bt1">
<asp:TextBox runat="server" />
<asp:Button id="bt1" Text="Default" runat="server" />
</asp:Panel>
</form>

Example

Set the DefaultButton Property for Panel Control