Pre_Init

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

protected void Page_PreInit(object sender, EventArgs e)

{

TextBox1.Text = TextBox1.GetType().ToString();

}

In the Pre_Init event of the page, I can set the value of say a TextBox's
Text property, but the TextBox isn't created until the Init event. Also I
noticed while debugging that 'The name 'x' does not exist in the current
context' appears if I set a breakpoint just after setting the TextBox.Text
value.

If I try to reference a control that doesn't exist after the Init event, I
get a runtime error. Why don't I get one in the Pre_init example above?

Mike
 
the controls defined on the aspx page are created at
FrameworkInitialize, which is well before PreInit.

-- bruce (sqlwork.com)
 
Do you know, in all the Page Life Cycle articles I have read, I've never
seen FrameworkInitialize mentioned.

Thank you.
 
Back
Top