开发者

How can I execute something between instantiation of the user control and OnInit call?

开发者 https://www.devze.com 2022-12-11 18:56 出处:网络
What is the simplest solutio开发者_StackOverflow中文版n here?This is probably the closest you can get:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号