Calling default event handler for my base class

N

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
 
J

John Saunders

NWx said:
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.
 
N

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!
 
J

John Saunders

NWx said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top