How can I execute something between instantiation of the user control and OnInit call?
What is the simplest solutio开发者_StackOverflow中文版n here?
This is probably the closest you can get:
protected override void OnInit(EventArgs e)
{
//your code here
base.OnInit(e);
}
According to the documentation Init
is the very first event invoked on a control. In other words: there are no extension points between the constructor and the OnInit()
method call.
I don't believe that it's possible.
Here is the execution lifecycle:
http://msdn.microsoft.com/en-us/library/aa719775(VS.71).aspx
Maybe if you share what you are trying to accomplish someone could offer an alternative approach.
Control adapters are the answer to the question.
精彩评论