Soldato
Hi all,
I am trying to run a couple of public voids in my C# code before the aspx page initialises. I tried to insert into my Page_Load code but on the first load my content loaded before my voids could run. Subsequent refreshes were fine.
I found this code that worked, but it seems a bit filthy to me? should I really be using a protected override void to get access to the OnPreInit method of the page?
Code below:
I am trying to run a couple of public voids in my C# code before the aspx page initialises. I tried to insert into my Page_Load code but on the first load my content loaded before my voids could run. Subsequent refreshes were fine.
I found this code that worked, but it seems a bit filthy to me? should I really be using a protected override void to get access to the OnPreInit method of the page?
Code below:
Code:
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
// Insert Code Here
}