difference between PreRender event and Page_Load event

  • Thread starter Thread starter Jimmy
  • Start date Start date
J

Jimmy

Hi

Can someone explain to me what the difference is between a PreRender event
and the Page Load event for a webform?

ch Jimmy
 
..

page_load is before the viewstate is reinstated, and prerender after the
viewstate is restored before the page is drawn to the reposnse stream.
 
page_load is before the viewstate is reinstated, and prerender after
the viewstate is restored before the page is drawn to the reposnse
stream.


Actually, this is not correct. Page_Load happens *after* ViewState and PostData
is set into all of your server side controls by ASP.NET (modulo any dynamic
controls being created on the page). Page_Init is the event fired prior to
ViewState and PostData being reinstated. Page_Load is where you typically
do any page wide initilization. Page_PreRedner is the last even you have
a chance to handle prior to the page's state being rendered into HTML. Page_Load
is the more typical event to work with. I can't think of a single time I've
needed to handle Page_PreRender in the 4+ years I've been doing ASP.NET (not
to say there aren't situations, but they're more rare than using Page_Load).

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
I can't think of a single time I've needed to handle Page_PreRender in
the 4+ years I've been doing ASP.NET (not to say there aren't situations,
but they're more rare than using Page_Load).

I have done it once in 2 years. I had dynamicly loaded controls where the
event fired on one effected the setting of another etc etc, but there you
go.
 
Back
Top