当您创建在Visual Studio默认情况下它一个新的Web用户控件添加Page_Load事件。什么是优势,在控制使用此,而不是重写基的OnLoad
事件?难道仅仅是的OnLoad之前的
?的Page_Load
事件触发
When you create a new web user control in visual studio it by default adds the Page_Load event. What is the advantage to using this rather than overriding the base OnLoad
event on the control? Is it just that the Page_Load
event fires before OnLoad
?
在的OnLoad
的方法应该是地方的加载
事件引发。我个人总是试图处理该事件,除非我需要做各地引发事件的额外处理。
The OnLoad
method should be the place where the Load
event is raised. I personally always try to handle the event unless I need to do extra processing around raising the event.
我建议处理的事件本身在正常情况下。
I recommend handling the event itself under normal circumstances.