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

ASP.NET 2.0 Include Files

Am a newbie to ASP.NET and have jumped right into 2.0.
I have a static menu (using the menu control) for just 3 pages on a 20 page
website.
I would like to put all the code in one place, as it will make maintenance
very easy.
In the good old ASP days I could use <#include ...>

What is the best way of putting my menu code in one place, available to all
3 pages, in ASP.NET???

Mar 28 '06 #1
6 3013
Create a master page...

and have all your other/real pages "inherit" from this MasterPage.


"Kevin" <ke*****@tesco.net> wrote in message
news:uu**************@TK2MSFTNGP14.phx.gbl...
Am a newbie to ASP.NET and have jumped right into 2.0.
I have a static menu (using the menu control) for just 3 pages on a 20 page website.
I would like to put all the code in one place, as it will make maintenance very easy.
In the good old ASP days I could use <#include ...>

What is the best way of putting my menu code in one place, available to all 3 pages, in ASP.NET???

Mar 28 '06 #2
re:
What is the best way of putting my menu code in one place, available to all 3 pages, in ASP.NET???
Write a user control.

Here's a good sample for ASP.NET 2.0 you can study and adapt :
http://www.devx.com/dotnet/Article/26609/0/page/1

The code for that article is at : http://assets.devx.com/sourcecode/11796.zip

There's a simpler ASP.NET 1.1 sample at :
http://www.dotnethero.com/hero/userc...y.aspx?nmx=7_2

The source for that one is at : http://www.dotnethero.com/hero/userc...avmenuCode.zip

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Kevin" <ke*****@tesco.net> wrote in message news:uu**************@TK2MSFTNGP14.phx.gbl... Am a newbie to ASP.NET and have jumped right into 2.0.
I have a static menu (using the menu control) for just 3 pages on a 20 page website.
I would like to put all the code in one place, as it will make maintenance very easy.
In the good old ASP days I could use <#include ...>

What is the best way of putting my menu code in one place, available to all 3 pages, in ASP.NET???

Mar 28 '06 #3
On Tue, 28 Mar 2006 16:04:05 -0600, sloan <sl***@ipass.net> wrote:
Create a master page...

and have all your other/real pages "inherit" from this MasterPage.


just adding a link to an MSDN article that actually starts out with 'how
you used to do it in ASP'

http://msdn.microsoft.com/msdnmag/is...20MasterPages/

--
Craig
Microsoft MVP - ASP/ASP.NET
Mar 28 '06 #4
I'd suggest you make it into a user control.
Here's more info:
http://SteveOrr.net/faq/UserCustom.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Kevin" <ke*****@tesco.net> wrote in message
news:uu**************@TK2MSFTNGP14.phx.gbl...
Am a newbie to ASP.NET and have jumped right into 2.0.
I have a static menu (using the menu control) for just 3 pages on a 20
page website.
I would like to put all the code in one place, as it will make
maintenance very easy.
In the good old ASP days I could use <#include ...>

What is the best way of putting my menu code in one place, available to
all 3 pages, in ASP.NET???

Mar 28 '06 #5
Thanks for all the information.
Am going to look at the UserControls.
I thought the MasterPage was a template for ALL pages, rather than just the
3 out of 20 I need?

Thanks a million to everyone.
Kevin

"Kevin" <ke*****@tesco.net> wrote in message
news:uu**************@TK2MSFTNGP14.phx.gbl...
Am a newbie to ASP.NET and have jumped right into 2.0.
I have a static menu (using the menu control) for just 3 pages on a 20
page website.
I would like to put all the code in one place, as it will make
maintenance very easy.
In the good old ASP days I could use <#include ...>

What is the best way of putting my menu code in one place, available to
all 3 pages, in ASP.NET???

Mar 28 '06 #6
On Wed, 29 Mar 2006 00:23:07 +0100, Kevin wrote:
I thought the MasterPage was a template for ALL pages, rather than just the
3 out of 20 I need?


You can have as many master pages as you want, and only apply them to
whatever pages you want.
Mar 28 '06 #7

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

Similar topics

7
by: Chad Scharf | last post by:
I have a legacy ASP application running on IIS 6.0 (Windows Server 2003 Web Edition) that is throwing an error when processesing a certain asp page that has about 200 or so include directives. ...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
7
by: mescaline | last post by:
Hi, Suppose a_file.cpp contains a function a_function() Now to include it in main_file.cpp I just do #include "a_file.cpp" and I'm all set. i recently came across this seemingly roundabout...
6
by: atv | last post by:
Alright, i have some questions concerning include files en global variables.I hope someone is willing to answer these. 1).Why is it that if i define a global variable in a file, say main.c, and...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
1
by: Minh | last post by:
I've just installed VS.NET 2003 on my Athlon XP 1800+. However I couldn't get any project with STL includes to compile even if I create a new empty project (and added #include <string>). It gave me...
1
by: ya man | last post by:
when i use #include <iostream.h> in some files i get lots of error messages of the kind 'ambiguous symbol this is solved when i use #include <iostream why is that ? and can i use #include...
9
by: chat | last post by:
Hi, every body. I have 3 files like this: -------------------------------------------------------- file name : header.h #ifndef TEST_H #define TEST_H int a=1; double b=0.5;
2
by: key9 | last post by:
Hi all look at the organize tree main.c ------ #include lib_adapter.c main() { foo();
16
by: Chris Shearer Cooper | last post by:
In our Visual Studio 2005 application, we have several of our application's H files that are #included into stdafx.h. What is odd, is that when we change those application H files, VS2005...
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:
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.