This documentation is archived and is not being maintained.

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)

[ThemeableAttribute(false)]
public:
virtual property bool AutoPostBack {
	bool get ();
	void set (bool value);
}
<asp:TextBox AutoPostBack="True|False" />

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.

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.

Security noteSecurity 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

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: