473,419 Members | 2,686 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,419 software developers and data experts.

multiple inheritance

Hi,

I'm working on a c# web app and require having some code which runs in the
page Load event of each page and to be reusable in other web apps.

So i decided to use a Class Library which contains a class that inherits
from the System.Web.UI.Page. the class contains an override of the OnLoad
event in which the common code is executed.

However, i also need to have an intermediate level class which inherits from
this base page to perform web app specific logic. this is were my problem
lies. If i make the actual web forms to inherit from the Intermediate page
which is overriding the OnLoad of the base page, the Page_Load event of the
web forms will not be executed.

Actually, the OnLoad event of the base page does not get executed also, but
i fixed this by placing a base.OnLoad(e) line in the OnLoad of the
intermediate page.

How can i make the BasePage OnLoad, the IntermediatePage OnLoad and the web
form Page_Load events get fired in that order?

regards,
Nov 19 '05 #1
2 1493
Sorry, I am really confused as to what you are asking here.

First off, 'multiple inheritance' typically refers to the ability to have
one class inherit from 2 or more other classes. Not to multi-level
inheritance hierarchy, which is what you are describing.

Secondly, I am confused as to what you are trying to accomplish or what
order you need things to fire in?

If every class overrides OnLoad, calls base.OnLoad first, and then does
whatever it needs to do, it will all be fine. If only the base class does
this and the child just handles the Load event, then the child's Load event
will fire first (since the OnLoad of the Page class raises this event), and
only then will the base class's custom code execute.

"Emmanuel" <em******@email.com> wrote in message
news:eG**************@TK2MSFTNGP11.phx.gbl...
Hi,

I'm working on a c# web app and require having some code which runs in the
page Load event of each page and to be reusable in other web apps.

So i decided to use a Class Library which contains a class that inherits
from the System.Web.UI.Page. the class contains an override of the OnLoad
event in which the common code is executed.

However, i also need to have an intermediate level class which inherits from this base page to perform web app specific logic. this is were my problem
lies. If i make the actual web forms to inherit from the Intermediate page
which is overriding the OnLoad of the base page, the Page_Load event of the web forms will not be executed.

Actually, the OnLoad event of the base page does not get executed also, but i fixed this by placing a base.OnLoad(e) line in the OnLoad of the
intermediate page.

How can i make the BasePage OnLoad, the IntermediatePage OnLoad and the web form Page_Load events get fired in that order?

regards,

Nov 19 '05 #2
Hi Marina,

yes, i meant to say multi-level inheritance. sorry about that.

The solution was so simple, and you brought me to it. Thanks a lot!

My problem was that the web form was not overriding the OnLoad method, but
was simply registering an event handler to the Load event.

regards,

"Marina" <so*****@nospam.com> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
Sorry, I am really confused as to what you are asking here.

First off, 'multiple inheritance' typically refers to the ability to have
one class inherit from 2 or more other classes. Not to multi-level
inheritance hierarchy, which is what you are describing.

Secondly, I am confused as to what you are trying to accomplish or what
order you need things to fire in?

If every class overrides OnLoad, calls base.OnLoad first, and then does
whatever it needs to do, it will all be fine. If only the base class does
this and the child just handles the Load event, then the child's Load
event
will fire first (since the OnLoad of the Page class raises this event),
and
only then will the base class's custom code execute.

"Emmanuel" <em******@email.com> wrote in message
news:eG**************@TK2MSFTNGP11.phx.gbl...
Hi,

I'm working on a c# web app and require having some code which runs in
the
page Load event of each page and to be reusable in other web apps.

So i decided to use a Class Library which contains a class that inherits
from the System.Web.UI.Page. the class contains an override of the OnLoad
event in which the common code is executed.

However, i also need to have an intermediate level class which inherits

from
this base page to perform web app specific logic. this is were my problem
lies. If i make the actual web forms to inherit from the Intermediate
page
which is overriding the OnLoad of the base page, the Page_Load event of

the
web forms will not be executed.

Actually, the OnLoad event of the base page does not get executed also,

but
i fixed this by placing a base.OnLoad(e) line in the OnLoad of the
intermediate page.

How can i make the BasePage OnLoad, the IntermediatePage OnLoad and the

web
form Page_Load events get fired in that order?

regards,


Nov 19 '05 #3

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

Similar topics

2
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
5
by: Morgan Cheng | last post by:
It seems no pattern defined by GoF takes advantage of multiple inheritance. I am wondering if there is a situation where multiple inheritance is a necessary solution. When coding in C++, should...
20
by: km | last post by:
Hi all, In the following code why am i not able to access class A's object attribute - 'a' ? I wishto extent class D with all the attributes of its base classes. how do i do that ? thanks in...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
47
by: Mark | last post by:
why doesn't .NET support multiple inheritance? I think it's so silly! Cheers, Mark
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
15
by: iKiLL | last post by:
hi all, I would like to be able to create an umbrella class for all my main global sections but I would still like to keep them all in separate file something like the below but I keep getting...
7
by: Adam Nielsen | last post by:
Hi everyone, I'm having some trouble getting the correct chain of constructors to be called when creating an object at the bottom of a hierarchy. Have a look at the code below - the inheritance...
47
by: Larry Smith | last post by:
I just read a blurb in MSDN under the C++ "ref" keyword which states that: "Under the CLR object model, only public single inheritance is supported". Does this mean that no .NET class can ever...
2
by: Paul McGuire | last post by:
On May 25, 8:37 am, Michael Hines <michael.hi...@yale.eduwrote: Here's a more general version of your testing code, to detect *any* diamond multiple inheritance (using your sample classes). --...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.