Page_OnInit event

  • Thread starter Thread starter Daves
  • Start date Start date
D

Daves

I am using 2.0 Masterpages. I want to add some text after the content page
code has been run and so thought I could add an OnInit event in the
masterpage class:

void Page_OnInit(System.EventArgs e)
{ .... }


for some reason this code is never run... Am I doing something wrong?
Running the debugger with a breakpoint it never halts there so it's
definitely not being run...
 
Hi,

in OnInit event server controls would perform any initialization steps that
are required to create and set up an instance. In this stage of the server
control's lifecycle, the control's view state has yet to be populated.
Additionally, you can not access server controls when this method is called
either, regardless of whether it is a child or parent control. Other server
controls are not certain to be created and ready for access.

Cheers,

Jerome. M
 
Back
Top