473,396 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Calling default event handler for my base class

NWx
Hi,

I defined a base class, Panel, based on System.Web.UI.UserControl, as below:
Public MustInherit Class Panel Inherits System.Web.UI.UserControl
.....
In another module, I want to define another custom control, Login, based on
Panel

Public MustInherit Class Login Inherits Panel

How can I call the event procedure for mz base class from the event
procedure of my child class?

For instance, I want to call Page_Load event of Panel from Page_Load of
Login class.

Thank you
Nov 18 '05 #1
3 2139
"NWx" <te**@test.com> wrote in message
news:uJ**************@TK2MSFTNGP10.phx.gbl...
Hi,

I defined a base class, Panel, based on System.Web.UI.UserControl, as below:

Public MustInherit Class Panel Inherits System.Web.UI.UserControl
.....
In another module, I want to define another custom control, Login, based on Panel

Public MustInherit Class Login Inherits Panel

How can I call the event procedure for mz base class from the event
procedure of my child class?

For instance, I want to call Page_Load event of Panel from Page_Load of
Login class.


Actually, you don't want to do that. If Panel is listening for the Load
event of the Page, then it will receive the event, otherwise not.

In other words, you don't have to do anything special beside declaring the
event handlers correctly with "Handles". Both the Page_Load of Login and the
Page_Load of Panel will be called.
--
John Saunders
John.Saunders at SurfControl.com
Nov 18 '05 #2
NWx
Thank you, I noticed this later, by putting some breakpoints along calling
chain.

However, I noticed Page_Load is first called for Page itself, then for
custom controls. Is there any way to force calling Page_load first for the
parent control, and only after for the inherited control (and finally for
the page)?

Regards!
"John Saunders" <john.saunders at SurfControl.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
"NWx" <te**@test.com> wrote in message
news:uJ**************@TK2MSFTNGP10.phx.gbl...
Hi,

I defined a base class, Panel, based on System.Web.UI.UserControl, as below:


Public MustInherit Class Panel Inherits System.Web.UI.UserControl
.....
In another module, I want to define another custom control, Login, based

on
Panel

Public MustInherit Class Login Inherits Panel

How can I call the event procedure for mz base class from the event
procedure of my child class?

For instance, I want to call Page_Load event of Panel from Page_Load of
Login class.


Actually, you don't want to do that. If Panel is listening for the Load
event of the Page, then it will receive the event, otherwise not.

In other words, you don't have to do anything special beside declaring the
event handlers correctly with "Handles". Both the Page_Load of Login and

the Page_Load of Panel will be called.
--
John Saunders
John.Saunders at SurfControl.com

Nov 18 '05 #3
"NWx" <te**@test.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Thank you, I noticed this later, by putting some breakpoints along calling
chain.

However, I noticed Page_Load is first called for Page itself, then for
custom controls. Is there any way to force calling Page_load first for the
parent control, and only after for the inherited control (and finally for
the page)?


No, the order is unspecified. You cannot and should not depend on it.
--
John Saunders
John.Saunders at SurfControl.com
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mark | last post by:
Hi, I'm looking for some ideas on how to build a very simple Event processing framework in my C++ app. Here is a quick background ... I'm building a multithreaded app in C++ (on Linux) that...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: Breeto | last post by:
Can anyone please tell me why the following doesn't work... using System; using System.Web; namespace AspTests {
0
by: Patrick Lioi | last post by:
We have form that is used as the base class of all of our forms, let's call it BaseApplicationForm. We have another form, say ChildApplicationForm that inherits from BaseApplicationForm. The...
3
by: polocar | last post by:
Hi, I'm writing a C# program (using Visual Studio 2005 Professional Edition). I have defined a class MyPanel in the following way: class MyPanel : Panel { ... }
3
by: =?Utf-8?B?RWR3aW4=?= | last post by:
Hello Everyone. Below is the code that is in question. --- BEGIN CODE WITHIN INHERITED FORM --- protected virtual void OnFormClosing(object sender, FormClosingEventArgs e) { switch...
3
by: Tony | last post by:
Hello! Is it the normal procedure in C# and .NET framework to always use the actual event object which is passed as the second parameters to the event handler. All of them are derived from...
1
by: AliR \(VC++ MVP\) | last post by:
Hi Everyone, I have a few form classes that inherit from the same base class. The main reason that this is done is that some event handlers are common between these classes and I was trying to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.