This documentation is archived and is not being maintained.
Page.IsPostBack Property
.NET Framework 1.1
Gets a value indicating whether the page is being loaded in response to a client postback, or if it is being loaded and accessed for the first time.
[Visual Basic] Public ReadOnly Property IsPostBack As Boolean [C#] public bool IsPostBack {get;} [C++] public: __property bool get_IsPostBack(); [JScript] public function get IsPostBack() : Boolean;
Property Value
true if the page is being loaded in response to a client postback; otherwise, false.
Example
[Visual Basic, C#, JScript] The following example tests the value of the IsPostBack property to conditionally call the Page.Validate method for all validation server controls when the Page is loaded.
[Visual Basic] Sub Page_Load If Not IsPostBack ' Validate initially to force the asterisks ' to appear before the first roundtrip. Validate() End If End Sub [C#] void Page_Load() { if (!IsPostBack) { // Validate initially to force asterisks // to appear before the first roundtrip. Validate(); } } [JScript] function Page_Load() { if (!IsPostBack) { // Validate initially to force the asterisks // to appear before the first roundtrip. Validate(); } }
[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
Show: