G
gozza
Hi,
Looks like I've misunderstood something about controls lifecycles. I have
an OnInit method override in my control:
protected override void OnInit(EventArgs e)
{
base.OnInit (e);
//some stuff
}
The control is then added to an ASPX page and an event handler is assigned
in the Page's OnInit override (as it's usually done by VS.NET, in the
InitilizeComponent method). The problem is that my event handler does not
get to do its work since the control's OnInit method always gets called
before the Page's OnInit method (i.e. the control's Init event gets
triggered before the Page's) and as a result, the event handler assignment
is made too late. Can someone please explain to me what's happening?
Any help will be highly appreciated.
Thanks,
Gozza
Looks like I've misunderstood something about controls lifecycles. I have
an OnInit method override in my control:
protected override void OnInit(EventArgs e)
{
base.OnInit (e);
//some stuff
}
The control is then added to an ASPX page and an event handler is assigned
in the Page's OnInit override (as it's usually done by VS.NET, in the
InitilizeComponent method). The problem is that my event handler does not
get to do its work since the control's OnInit method always gets called
before the Page's OnInit method (i.e. the control's Init event gets
triggered before the Page's) and as a result, the event handler assignment
is made too late. Can someone please explain to me what's happening?
Any help will be highly appreciated.
Thanks,
Gozza