473,287 Members | 1,643 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,287 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 2135
"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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.