Sunday, February 6, 2011

What is a page Postback?
When a Page Loads, it is either loading for the first time or it is loading again based on some kind of user interaction with that page. In the case of the latter, we call this a Postback.


How to avoid problems with Postback
You may have code in your load event that should only run the first time a page loads. 

Each page contains a boolean property called IsPostback. This property can be checked at runtime to determine whether the page is loading for the first time or posting back to itself.


Use an If statement to determine the state of the Postback property.

Further reading:


MSDN: Page.IsPostback property http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx

No comments:

Post a Comment