I'm working on a website in which the C# code must remain within the layout pages. So, for example, in Default.aspx, there exists this method:
protected override void OnLoad(EventArgs e)
{
// Assorted code here
.
.
.
}
I need to add some code dealing with the setting of one of two master pages which needs to be executed
before the Page Load and Page Init events.
First I tried this:
protected override void OnPreInit(EventArgs e)
{
// Assorted code here
.
.
.
}
The app ran but this event was never fired.
Yet with this syntax everything worked fine:
protected override void Page_PreInit(EventArgs e)
{
// Assorted code here
.
.
.
}
I'm most currious what "OnLoad" works but "OnPreInit" fails. Anyone know?
Robert
Go to the complete details ...