472,799 Members | 1,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,799 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 1776
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 :...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.