Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the importance of autopostback? 2

Status
Not open for further replies.

ashstampede

Programmer
Joined
Aug 30, 2004
Messages
104
Location
GB
In my asp application is very database driven, set of things are done on one page and then transfer to another page via button click.
what i am trying to figure out is why does the application runs through the code on the first page beofre sending you to the second page. That seems like a huge waste and possible slow down if there is a mass load of traffic.

is this caused by autopost back or what? and if so why is autopost back set to true by default? it there away i can avoid the application re doing all the code before sending you to the next page?
 
Very briefly, pages post back since ASP.NET conforms to the paradigm of reentrant pages.

I surmise that the code that you do not want to be executed on postbaack is, for the most part, confined to the page's load event. Preventing its execution only requires wrapping an if statement around it that investigates the IsPostBack property of the page, and so only the code for the control/event that caused postback will fire (where you ay have your server.transfer or response.redirect statement, etc.)

HTH

Amit
 
well that was just as an exsample, becuase no there is other code that i don't want re executing. and i do have some page where the need to check for ispostback was important, but i was asking more on the lines of if i set autopostback to false will it effect my application hugely if it is a page where i don't need to check whats happening on autopostback?

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top