473,779 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling default event handler for my base class

NWx
Hi,

I defined a base class, Panel, based on System.Web.UI.U serControl, as below:
Public MustInherit Class Panel Inherits System.Web.UI.U serControl
.....
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 2150
"NWx" <te**@test.co m> wrote in message
news:uJ******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

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

Public MustInherit Class Panel Inherits System.Web.UI.U serControl
.....
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.saunder s at SurfControl.com > wrote in message
news:e8******** ******@TK2MSFTN GP12.phx.gbl...
"NWx" <te**@test.co m> wrote in message
news:uJ******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

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


Public MustInherit Class Panel Inherits System.Web.UI.U serControl
.....
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.co m> wrote in message
news:%2******** ********@tk2msf tngp13.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
6088
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 uses message queues to pass pointers to Events between threads. In my app there are simple events that can be defined using an enum (for example an event called NETWORK_TIMEOUT) and more complex events that contain data (for example an event called...
5
3437
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 5), but fails on IIS 6 running on a Win2003 server. The web uses Pages derived from a custom class I wrote (which itself derives from Page) to provide some common functionality. The Page_Load handler the failing webpage starts out like this: ...
1
11583
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
2
8358
by: Breeto | last post by:
Can anyone please tell me why the following doesn't work... using System; using System.Web; namespace AspTests {
0
1856
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 child form implements an event handler for the Resize event. Inside BaseApplicationForm.InitializeComponent, this.ClientSize is set to a value. On most of our developers' machines, this.ClientSize = ....; does NOT fire the Resize event, which makes...
3
1817
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
2166
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 (e.CloseReason) { case CloseReason.UserClosing: if (this.AskUserIfOkayToClose() == true) { this.ExecuteApplicationCloseProcedures(); }
3
1370
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 the base class which is EventArgs so because of this the second parameters could in all cases be EventArgs which had be be cased in the most cases to the the actual referenced event argument object before
1
3366
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 save time and not have to put a event handler in every form class. The base class has an event handler for Edit.Enter and Edit.Leave so that it can turn the Edit menu items on and off.
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9930
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.