Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Page_Load in derived classes

Reply
Thread Tools

Page_Load in derived classes

 
 
John Grandy
Guest
Posts: n/a
 
      08-06-2007
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 ?


 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=
Guest
Posts: n/a
 
      08-06-2007
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.

"John Grandy" wrote:

> 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 ?
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 01:44 PM
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 12:07 AM
in VB.NET Page_load of a base class called after the derived class Page_load ? z. f. ASP .Net 0 10-19-2004 12:01 PM
order of execution of page_load in a base and derived classes Ignacio Machin \( .NET/ C# MVP \) ASP .Net 13 09-02-2004 01:59 PM
Base Classes in .exe, derived classes in .dll Colin Goudie C++ 6 01-26-2004 03:18 PM



Advertisments