DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 6 Aug 2007 13:27:11 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    John Grandy johnagrandy-at-gmail-dot-com
          2    Sergey Poberezovskiy


Page_Load in derived classes   
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 ?
Date:Mon, 6 Aug 2007 13:27:11 -0700   Author:  

RE: Page_Load in derived classes   
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 ? 
> 
> 
> 
Date:Mon, 6 Aug 2007 15:10:03 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us