ASP.NET 2.0 Include Files

K

Kevin

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???
 
S

sloan

Create a master page...

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

Juan T. Llibre

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/usercontrols/Web-Control-Library.aspx?nmx=7_2

The source for that one is at : http://www.dotnethero.com/hero/usercontrols/navmenuCode.zip
 
K

Kevin

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
 
E

Erik Funkenbusch

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,130
Latest member
MitchellTe
Top