C# : Tutorial of Asp.net with c# and example

Example and code about windows application, web application, SQL, C#, WPF etc which is helpful to developer and programer.

Search This Blog

how to use ispostback proerty in asp.net with example

♠ Posted by uvesh master in at Tuesday, August 26, 2014

Use of IsPostBack property and its example

It is not method.
It is the property in the System.Web.UI namespace.
It should be Page.IsPostBack.

IsPostback property is used to Gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback.

This IsPostBack property returns the boolean value either True or False.

The following example shows how to test the value of the IsPostBack property when the page is loaded
in order to determine whether the page is being rendered for the first time or is responding to a postback.
If the page is being rendered for the first time, the code calls the  excuteonpageload() method.

private void Page_Load()
    if (!IsPostBack)
        // Validate initially to force asterisks
        // to appear before the first roundtrip.

After render the web page, if you do any post back then it will be called. In the web page,
we used to check whether its loaded first time or posted back.
Because we do not want to bind the concrete controls to rebind again.
It will increase the performance of the web application.

Improve Your Answer as comment below.
If our post is useful please share and comment on our post for more post and detail Visit :



Post a Comment