TextBox::AutoPostBack Property

 

Gets or sets a value that indicates whether an automatic postback to the server occurs when the TextBox control loses focus.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
[ThemeableAttribute(false)]
property bool AutoPostBack {
	virtual bool get();
	virtual void set(bool value);
}

Property Value

Type: System::Boolean

true if an automatic postback occurs when the TextBox control loses focus; otherwise, false. The default is false.

Use the AutoPostBack property to specify whether an automatic postback to the server will occur when the TextBox control loses focus. Pressing the ENTER or the TAB key while in the TextBox control is the most common way to change focus.

System_CAPS_noteNote

If the TextBox control's parent container contains a button marked as the default button (for example, if the container's DefaultButton or DefaultButton property is set), the default button's Click event is not raised in response to the automatic postback.

This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.

The following example shows how to use the AutoPostBack property to automatically display the sum of the values entered in the text boxes when the TextBox control loses focus.

System_CAPS_security Security Note

This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: