Page_Init() and Page_Load()

  • Thread starter Thread starter Christian
  • Start date Start date
C

Christian

Hi,

what is the purpose of having a Page_Init() AND a Page_Load() event handler
'cause both will always be executed on loading a page ?

What code do you typically put in one event or in the other event ?

thanks

chris
 
When you need to restore the viewstate of a control on the webpage you
should create an instace of this webcontrol in the page_init. The reason for
this is that the viewstate is loaded between the init and the load event. So
this also means that is you want to access the value of a web control after
a postback you have to do this after the viewstate has been restored, so you
can not do this in the page_init.

This is one example, probably there are some more...

/Cristian
 
Back
Top