difference between PreRender event and Page_Load event

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
 
J

Josh

..

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

Brock Allen

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).
 
J

Josh

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top