John,
Page_Load is an event which is called by base class, whereas OnLoad is an
override which is executed instead of the base method.
To summarise:
Page_Load event is called in both classes (it is up to the programmer
whether to supply a handler and in which class); those events are independent
and the execution order cannot be guaranteed.
OnLoad overrides base class method, and the code is executed in the
inherited class. It is up to the programmer whether to call base class
(OnLoad) method - which is usually a good practice as there may be other
listeners attached to that.
In this case the programmer can decide whether to execute the custom code
before or after calling the base method.
> If I have UserControlDervied that derives from another UserControlBase , and
> in UserControlBase the OnLoad method is overriden , is it necessary to also
> override the OnLoad method in UserControlDerived , or can the magic
> Page_Load method be used ? Does Page_Load automatically call OnLoad in any
> underlying class ?