October 2010
Intermediate to advanced
1920 pages
73h 55m
English
Page.IsPostBack PropertyThe Page class includes a property called the IsPostBack property, which you can use to detect whether the page has already been posted back to the server.
Because of View State, when you initialize a control property, you do not want to initialize the property every time a page loads. Because View State saves the state of control properties across page posts, you typically initialize a control property only once, when the page first loads.
Many controls don’t work correctly if you reinitialize the properties of the control with each page load. In these cases, you must use the IsPostBack property to detect whether the page has been posted.
The page in Listing 1.17 illustrates how you can use the Page.IsPostBack ...