Page_Init() and Page_Load()

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
 
C

Cristian Suazo

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
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top