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

Multiple Code Behind Pages

Hello,

Can a Code Behind Page call another page? I have 4 aspx.vb pages that have
a portion of the code that is common. Every time I need to make a change, I
have to make that change in all 4 files. Can the common code be moved to
it's own page? If so, How would I reference it?

Any advice would be appreciated.

--
Thanks in advance,

Steven
Nov 18 '05 #1
5 3192
Use inheritance.
Have one page that has all the shared info, functions, etc. Then have the
other pages inherit from that instead of System.Web.Page.
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Steven K" <sk****@troop.com> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hello,

Can a Code Behind Page call another page? I have 4 aspx.vb pages that
have
a portion of the code that is common. Every time I need to make a change,
I
have to make that change in all 4 files. Can the common code be moved to
it's own page? If so, How would I reference it?

Any advice would be appreciated.

--
Thanks in advance,

Steven

Nov 18 '05 #2

"Steven K" <sk****@troop.com> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hello,

Can a Code Behind Page call another page? I have 4 aspx.vb pages that have
a portion of the code that is common. Every time I need to make a change, I
have to make that change in all 4 files. Can the common code be moved to
it's own page? If so, How would I reference it?

Any advice would be appreciated.

--
Thanks in advance,

Steven


Check out the user controls (in-project user controls.) They help tremendously
with keeping code from being duplicated :)

Add->Web User Control

Hope this helps.

Mythran
Nov 18 '05 #3
In addition to the 2 excellent suggestions from Curt_C and Mythran, you
could also put the code into a shared library (DLL) and reference that in
the 4 pages that need it. The choice of method would be the one that is the
most natural fit to your particular code requirements.

Colin

"Steven K" <sk****@troop.com> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hello,

Can a Code Behind Page call another page? I have 4 aspx.vb pages that have a portion of the code that is common. Every time I need to make a change, I have to make that change in all 4 files. Can the common code be moved to
it's own page? If so, How would I reference it?

Any advice would be appreciated.

--
Thanks in advance,

Steven

Nov 18 '05 #4
In that case, might as well just use a Module or Class file inside the single
project if there are only a few routines. If it is larger in scope, then yeah,
put into a shared library project under the same solution :)

Mythran

"Colin Young" <x@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
In addition to the 2 excellent suggestions from Curt_C and Mythran, you
could also put the code into a shared library (DLL) and reference that in
the 4 pages that need it. The choice of method would be the one that is the
most natural fit to your particular code requirements.

Colin

"Steven K" <sk****@troop.com> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hello,

Can a Code Behind Page call another page? I have 4 aspx.vb pages that

have
a portion of the code that is common. Every time I need to make a change,

I
have to make that change in all 4 files. Can the common code be moved to
it's own page? If so, How would I reference it?

Any advice would be appreciated.

--
Thanks in advance,

Steven


Nov 18 '05 #5
So now we have four solutions. Thanks. I was trying to think of the word
module or class this morning but my brain didn't want to work.

Colin

"Mythran" <ki********@hotmail.com> wrote in message
news:u2**************@TK2MSFTNGP09.phx.gbl...
In that case, might as well just use a Module or Class file inside the single project if there are only a few routines. If it is larger in scope, then yeah, put into a shared library project under the same solution :)

Mythran

"Colin Young" <x@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
In addition to the 2 excellent suggestions from Curt_C and Mythran, you
could also put the code into a shared library (DLL) and reference that in the 4 pages that need it. The choice of method would be the one that is the most natural fit to your particular code requirements.

Colin

"Steven K" <sk****@troop.com> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hello,

Can a Code Behind Page call another page? I have 4 aspx.vb pages that

have
a portion of the code that is common. Every time I need to make a change,
I
have to make that change in all 4 files. Can the common code be moved

to it's own page? If so, How would I reference it?

Any advice would be appreciated.

--
Thanks in advance,

Steven



Nov 18 '05 #6

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

Similar topics

1
by: Arne | last post by:
All my code behind pages gets compiled into one DLL. I would like to redirect my code behind into multiple DLLs so that I get more flexibility when installing new features to a web site. I am adding...
3
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I...
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
1
by: Me | last post by:
Hi, I inherited a web application that has several very similar forms for gathering user data. User's must choose the form that best fits their needs and fill it out. Each form has about 15...
7
by: Nathan Sokalski | last post by:
I have user controls that contain a link to a stylesheet. Several of my pages also have a link to this same stylesheet. Because of this, the resulting output contains multiple links to the same...
1
by: David Herbst | last post by:
I have a solution that contains one main web project, ten sub web projects and a controls library project all in a single web application. I followed the steps in the following MS KB: How To...
0
by: just.an.imbecile | last post by:
Hello all, I am writing code for a website that has already been designed. After having written most of the code behind, my boss decides that the ..aspx page needs to be split into 4 pages with...
1
by: LiveCycle | last post by:
Hi, I'm putting together a project that uses ASP.NET in VS2005. It uses a single master page that is responsible for most of the heavy lifting. About 90% of the 200 pages have the same...
8
by: Yofnik | last post by:
Hello, We have developed a web application that provides a specific set of functionality. Our customers may want to add a few additional ASP.NET web pages to this web application to provide some...
2
by: Max2006 | last post by:
Hi, Is there any way to break a web application into separated web projects, so we can re-use pages\? I am trying to put aspx pages and/or ascx pages in separated web projects,
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.