HtmlForm.DefaultButton Property
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 Value
The ID of the button control to display as the default button when the HtmlForm is loaded. The default value is an empty string ("").| Exception type | Condition |
|---|---|
| The control referenced as the default button is not of the type IButtonControl. |
The button specified as the default button posts back to the server if the user presses the ENTER key after the page is loaded without navigating to a different control on the form. You can specify any control that raises an event when it is clicked for the DefaultButton property. If the control referenced by the DefaultButton property is not of the type IButtonControl, an InvalidOperationException exception is thrown.
If you are using master pages in your application and you are setting the DefaultButton property from a content page, use the UniqueID property of the IButtonControl button. For more information on master pages, see ASP.NET Master Pages Overview.
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.