473,395 Members | 1,846 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,395 software developers and data experts.

Page Inheritance

Leo
I would like to create a base page with some code and server controls on it and then inherit that page in all my other pages. I have tried in the codebehind changing
Inherits Systgem.Web.UI.Page
to
Inherits myBasePage

and in the HTML for the page.aspx changing
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="InheritanceText.TestForm"%>
to
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="InheritanceText.myBaseForm"%>

I would like the page that is inheriting from myBaseForm to inherit all the visual and server controls also. Is this possible in VS 2003 and if so what do I need to do?
Nov 18 '05 #1
4 1051
This probably might not be as you would expect. Although the code that
initializes the controls might be inherited, the HTML is not.

To reuse layout, you might want to consider using usercontrols.

"Leo" <ne**********@cox.net> wrote in message
news:eF*************@TK2MSFTNGP10.phx.gbl...
I would like to create a base page with some code and server controls on it
and then inherit that page in all my other pages. I have tried in the
codebehind changing
Inherits Systgem.Web.UI.Page
to
Inherits myBasePage

and in the HTML for the page.aspx changing
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb"
Inherits="InheritanceText.TestForm"%>
to
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb"
Inherits="InheritanceText.myBaseForm"%>

I would like the page that is inheriting from myBaseForm to inherit all the
visual and server controls also. Is this possible in VS 2003 and if so what
do I need to do?
Nov 18 '05 #2
It is possible in ASP.NET 2.0 with MasterPages. You can start using it now if you are happy with beta.

Eliyahu

"Leo" <ne**********@cox.net> wrote in message news:eF*************@TK2MSFTNGP10.phx.gbl...
I would like to create a base page with some code and server controls on it and then inherit that page in all my other pages. I have tried in the codebehind changing
Inherits Systgem.Web.UI.Page
to
Inherits myBasePage

and in the HTML for the page.aspx changing
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="InheritanceText.TestForm"%>
to
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb" Inherits="InheritanceText.myBaseForm"%>

I would like the page that is inheriting from myBaseForm to inherit all the visual and server controls also. Is this possible in VS 2003 and if so what do I need to do?
Nov 18 '05 #3
If you are looking for something similar to the 2005 master pages in the
2002 and 2003 environments I would recommend looking into Paul Wilson's
master page article. Originally this was posted on MSDN but an updated
version of it can be found at:

http://authors.aspalliance.com/PaulW...rticles/?id=14

You can google for the original if you'd like. Anyway this is actually
quite easy to use, is very flexible, and give you the ability to
override areas of your master pages. Takes a bit of getting use to at
first, but works like a champ.

Have A Better One!

John M Deal, MCP
Necessity Software

Eliyahu Goldin wrote:
It is possible in ASP.NET 2.0 with MasterPages. You can start using it
now if you are happy with beta.

Eliyahu

"Leo" <ne**********@cox.net <mailto:ne**********@cox.net>> wrote in
message news:eF*************@TK2MSFTNGP10.phx.gbl...
I would like to create a base page with some code and server
controls on it and then inherit that page in all my other pages. I
have tried in the codebehind changing
Inherits Systgem.Web.UI.Page
to
Inherits myBasePage

and in the HTML for the page.aspx changing
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="TestForm.aspx.vb" Inherits="InheritanceText.TestForm"%>
to
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="TestForm.aspx.vb" Inherits="InheritanceText.myBaseForm"%>
I would like the page that is inheriting from myBaseForm to inherit
all the visual and server controls also. Is this possible in VS
2003 and if so what do I need to do?

Nov 18 '05 #4
Actually, you can do just as you describe without going to MasterPages,
although that will make it easier. Yes, I've done it so that I can share
the extended Page class containing global functions that need access to the
current context. I couldn't get that to work globally otherwise. Also good
for enumerations and constants that you want available site-wide.
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uo**************@TK2MSFTNGP14.phx.gbl...
It is possible in ASP.NET 2.0 with MasterPages. You can start using it now
if you are happy with beta.

Eliyahu

"Leo" <ne**********@cox.net> wrote in message
news:eF*************@TK2MSFTNGP10.phx.gbl...
I would like to create a base page with some code and server controls on it
and then inherit that page in all my other pages. I have tried in the
codebehind changing
Inherits Systgem.Web.UI.Page
to
Inherits myBasePage

and in the HTML for the page.aspx changing
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb"
Inherits="InheritanceText.TestForm"%>
to
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="TestForm.aspx.vb"
Inherits="InheritanceText.myBaseForm"%>

I would like the page that is inheriting from myBaseForm to inherit all the
visual and server controls also. Is this possible in VS 2003 and if so what
do I need to do?
Nov 18 '05 #5

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

Similar topics

1
by: BK | last post by:
I am writing a tiered inheritance structure in ASP.NET and would like opinions on the best way to accomplish the correct inheritance dynamically. The page structure is going to look similar to the...
1
by: George Durzi | last post by:
I'm converting a c# web application to support page inheritance so that I can really change the look and feel of my application by only modifying the ..cs that my pages inherit from. The only...
5
by: Invalidlastname | last post by:
Hi, I just read the pattern "Design and Implementation Guidelines for Web Clients" from MSDN. Here is my question. In chapter 3,...
1
by: Andy Fish | last post by:
Hi, I have been thinking about the design of a large ASP.NET app and I've read people have a lot of trouble implementing front controller, especially with postbacks, so I don't feel comfortable...
1
by: Craig Street | last post by:
Hi How do i create a base page in ASP.NET 2.0? I don't want to use master pages as I don't need any visual inheritance. You could do this simply in ASP.NET 1.1 by creating a base page that...
3
by: Jim Heavey | last post by:
Hello, my company has a standard format that I must follow when creating a page. The top portion of the page contains a standard heading which should be placed on each page. This "heading" has a...
4
by: roger janssens via DotNetMonster.com | last post by:
hello all. i'm used to scripting in php. there, you just include(bla.php) and it works. so i have a template that defines my layout and stays the same forever, but in that file, there's a table...
7
by: tshad | last post by:
I have a control that I am using from Metabuilders that requires you to use: <%@ Page Inherits="MetaBuilders.WebControls.DialogPage" %> How do I inherit my code-behind page or another object...
3
by: Pini | last post by:
Hi all,In asp.net 1.x i creates a basepage that extends System.Web.UI.Page class. I created this file in a web appplcaition project and then refernced it from another projects. All the pages in...
7
by: iguana84 | last post by:
Hi, I have a newbie question for (ASP.Net 2.0 framework) which is based on Design Pattern / Coding Trick --> I need to :- - Inherit one aspx page and its code (super abstract class)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.