Page.IsPostBack Property
.NET Framework 3.0
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.
Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
'Declaration Public ReadOnly Property IsPostBack As Boolean 'Usage Dim instance As Page Dim value As Boolean value = instance.IsPostBack
/** @property */ public boolean get_IsPostBack ()
public function get IsPostBack () : boolean
Not applicable.
Property Value
true if the page is being loaded in response to a client postback; otherwise, false.The following code 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.
Sub Page_Load If Not IsPostBack ' Validate initially to force the asterisks ' to appear before the first roundtrip. Validate() End If End Sub
void Page_Load()
{
if (!(this.get_IsPostBack()))
{
// Validate initially to force asterisks
// to appear before the first roundtrip.
Validate();
}
}
function Page_Load() { if (!IsPostBack) { // Validate initially to force the asterisks // to appear before the first roundtrip. Validate(); } }
Community Additions
ADD
Show: