Hi Simon,
Let me see if I can explain a bit about WebForms, the CodeBehind model, and
Inheritance. Forgive me if I mention anything you already know; I just want
to cover all the bases. I will begin with Inheritance. Put simply, a class
that inherits another class obtains all of the characteristics of the
inherited class, Properties, Fields, Methods, etc. The new class can now
extend the inherited class by adding other characteristics to it. This, of
course, has no effect on the inherited class.
The CodeBehind model is a way of separating Interface (HTML and related
server-side tags) and Interface business logic. What you refer to as "design
view" is actually a Template. It inherits the CodeBehind class. If you take
a look at the HTML view of that file, you will see the Inherits statement in
the @Page tag. So, you can only inherit from the CodeBehind class.
IOW, if you want to inherit a Control from a Page class, it will have to be
declared in the CodeBehind class that you inherit from, and there will have
to be a tag in the inheriting template, or the Control will have to be
dynamically created in the CodeBehind.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
"Simon" <si**********@N O.SPAMiprimus.c om.au> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
Hi,
Just to get started....
I've created a very simple web form, "Simple", using VS and I dropped a
HTML img control on the design view. I referenced a picture and it is
displayed in browser view. Very simple.
I have created a second form and in the code-behind page I have altered
the class definition to inherit from, "Simple".
When viewing the second form in the browser the 'inherited' image from the
first form is not shown.
Examples I have found of web form inheritance tend to all deal with the
"Simple" form being only a code page (a class) that renders its content in
code rather than having any design view.
Can a Webform only inherit content from a base class that is code only or
can content in the .aspx file also be inherited?
Thanks,
gramps