Assembly: System.Web (in system.web.dll)
/** @property */ public String get_DefaultButton () /** @property */ public void set_DefaultButton (String value)
public function get DefaultButton () : String public function set DefaultButton (value : String)
Property ValueThe ID of the button control to display as the default button when the HtmlForm is loaded. The default value is an empty string ("").
The DefaultButton property lets you specify that users can cause a postback by pressing ENTER in an input control in the form (such as a text box). You can specify as a default button any control that derives from the IButtonControl interface except the LinkButton control. If the control that is referenced by the DefaultButton property does not derive from IButtonControl, an InvalidOperationException exception is thrown.
If you are using master pages and you set the DefaultButton property from a content page, use the UniqueID property of the IButtonControl button. For more information about master pages, see ASP.NET Master Pages Overview.
The DefaultButton property might not cause a postback in the following scenarios:
Pressing ENTER when focus is outside the input controls in the form. The default postback action is not guaranteed to be triggered.
Changing the DefaultButton property programmatically during an asynchronous postback. Asynchronous postbacks can be enabled on a page by adding one or more UpdatePanel controls to the page. For more information, see UpdatePanel Control Overview and Partial-Page Rendering Overview.