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
bruce barker - 31 Aug 2007 16:23 GMT
the controls defined on the aspx page are created at
FrameworkInitialize, which is well before PreInit.
-- bruce (sqlwork.com)
> protected void Page_PreInit(object sender, EventArgs e)
>
[quoted text clipped - 14 lines]
>
> Mike
Mike - 31 Aug 2007 17:00 GMT
Do you know, in all the Page Life Cycle articles I have read, I've never
seen FrameworkInitialize mentioned.
Thank you.
> the controls defined on the aspx page are created at FrameworkInitialize,
> which is well before PreInit.
[quoted text clipped - 20 lines]
>>
>> Mike