Property Value

Use the DefaultButton property to indicate which button gets clicked when the Panel control has focus and the user presses the ENTER key. The DefaultButton can be set to the identifier for a Button control or any control that implements the IButtonControl interface except a LinkButton control.

If the DefaultButton is set to a control that does not implement the IButtonControl interface, or to a control that is not contained in the Panel control, the Panel control throws an exception while rendering.

Setting the DefaultButton property is not supported for the following scenarios:

Setting focus outside of the input controls in the panel and then pressing the ENTER key. The default post back action is not guaranteed to trigger.

Pressing the ENTER key with focus inside a multi-line textbox. In a multi-line textbox, pressing the ENTER key should create a new line in the textbox which is the expected behavior. In browsers where the pressing the ENTER key inside a multi-line textbox triggers a post back but you want the ENTER key to create a new line instead you can attach a JavaScript function to the input control. The script should capture the ENTER key and stop the post back. For example, you can use the Attributes property collection to add client script for the onKeyPress event.