473,395 Members | 1,539 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.

inheriting/reusing common code

Hi, basic question here - I'm struggling with the transfer from asp to
asp.net a bit, especially in seeing the 'bigger picture' of how things are
best structured.

I have a website made up primarily of aspx pages. I have separated out the
common <head> as an .ascx file and intend to do the same for other common
regions of html.

In the aspx.vb I have code that is common to all pages. For example a sub
which is passed a parameter to tell it the url of the page and builds a menu
with the current page highlighted, and another which passes in Page Title to
the .ascx mentioned above.

Being common code (just the param that varies), I would like to extract
these routines and effectively have one aspx.vb which is common to all aspx
files. How do I do that? All aspx sharing a single codebehind, or at least
inheriting from the common one, and being able to override code in their own
code behind.

Are there any really good books/online tutorials that cover this sort of
architecture planning?

Cheers,

Richard
Jul 21 '05 #1
1 1832
With 1.1 you can inherit the code (tnot the markup) from another page.
Basically you could have this in a main page class and for other pages
inherits from MyApp.MyPage instead of inheriting from System.Web.UI.Page....

Another option is to look at "masterpages" support. You'll likely find some
controls to add this to 1.1. and it is part of 2.0.

Patrice

--

"richardlane" <ri*********@discussions.microsoft.com> a écrit dans le
message de news:2C**********************************@microsof t.com...
Hi, basic question here - I'm struggling with the transfer from asp to
asp.net a bit, especially in seeing the 'bigger picture' of how things are
best structured.

I have a website made up primarily of aspx pages. I have separated out the
common <head> as an .ascx file and intend to do the same for other common
regions of html.

In the aspx.vb I have code that is common to all pages. For example a sub
which is passed a parameter to tell it the url of the page and builds a menu with the current page highlighted, and another which passes in Page Title to the .ascx mentioned above.

Being common code (just the param that varies), I would like to extract
these routines and effectively have one aspx.vb which is common to all aspx files. How do I do that? All aspx sharing a single codebehind, or at least
inheriting from the common one, and being able to override code in their own code behind.

Are there any really good books/online tutorials that cover this sort of
architecture planning?

Cheers,

Richard

Jul 21 '05 #2

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

Similar topics

8
by: John M. Gabriele | last post by:
I'm putting together a small site using Python and cgi. (I'm pretty new to this, but I've worked a little with JSP/servlets/Java before.) Almost all pages on the site will share some common...
4
by: Old Wolf | last post by:
#include <stdio.h> #include <stdarg.h> Is this safe: void foo(const char *fmt, ...) { va_list ap; va_start(ap,fmt);
3
by: CaribSoft | last post by:
I want to create my own common dialog to use in an application . How do I show a custom dialog (form) in a class based on the common dialog class?
2
by: Wayne J | last post by:
I have 3 pages, each with 2 tables (tblNew and tblConfirm), because these 2 tables are affected by the same code, I thought if I used an inherited class defining these variables along with the...
1
by: bminder | last post by:
In the asp.net pages below, Common.vb has an overridable Page_Load sub. In the consuming page, Two.aspx, the Page_Load sub is inherited, but for some reason it (Overrides Sub Page_Load) executes...
1
by: richardlane | last post by:
Hi, basic question here - I'm struggling with the transfer from asp to asp.net a bit, especially in seeing the 'bigger picture' of how things are best structured. I have a website made up...
24
by: toton | last post by:
Hi, I want to have a vector like class with some additional functionality (cosmetic one). So can I inherit a vector class to add the addition function like, CorresVector : public...
2
by: brazil.mg.marcus.vinicius.lima | last post by:
Hi, I'm constructing a query that will performs a lot o datetime calculumns to generate columns. All that operations are dependent of a base calculum that is performed on the query and its...
4
by: AalaarDB | last post by:
struct base { int x, y, z; base() {x = 0; y = 0; z = 0;}; base(int x1, int y1, int z1) {x = x1; y = y1; z = z1;}; }; struct intermediate1 : public virtual base {}; struct intermediate2 :...
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: 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
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...
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
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
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.