How to use IsPostBack property in ASP.NET pages to determine if the page is posted back

This article demonstrates how you can use the Page.IsPostback proeprty to determine of the page is submitted or it is first time loading.

In ASP.Net, the Page Load is event is fired every time a page is loaded. This is true even if the page is loaded as part of a submit button click. You may need to identify if the page load event is called as part of a page submit or if it is a fresh page rendering. Because, in case of page submit, you may want to skip several task like populating the data again etc.

The IsPostBack property can be used to determine if the page is submitted to itself. When a form is posted (submitted) back to the same page that contains it, it's called a post back. ASP.NET provides a property called IsPostBack that is TRUE when the page is being loaded as a result of a post back, and is FALSE otherwise.

We can check the value of this property and based on the value, we can populate the controls in the page. If the property is TRUE, that means it is a postback (submit) and no need to populate all the values again.


Sub Page_Load
IF Not IsPostBack THEN
' Need to do load the grid only if it is first time load.
grdtest.DataSource = Session("dS")
End Sub


Author: Ahmad M. Alkilani27 Apr 2004 Member Level: Bronze   Points : 0

Thank you for writting this article. You explained the topic well.

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: