Examples of building web site navigation for ASP.NET site?

  • Thread starter Thread starter Jason Hanks
  • Start date Start date
J

Jason Hanks

Hi, are there any examples that demonstrate how to build an ASP.NET page
with consistent parts of the layout, such as page headers, footers, and
navigation links (such as going into each section like Products, Company,
Services, etc)?

I know there are controls that you can use to build menus like ASP.NET menu.
But I'm talking more about the graphical elements and layout that needs to
be part of each page.

For example when I designed my site in old ASP I had include files. So I
did something like this from each page:

<!-- #INCLUDE VIRTUAL="/top-of-page.inc"-->
main page content goes here
<!-- #INCLUDE VIRTUAL="/bottom-of-page.inc"-->

But in ASP.NET that doesn't seem like a concept that works. Instead it
seems like maybe I have a common class or something that will write out my
headers and footers so I have a consistent look and feel, and so I can just
change nav links in one place as I make changes to the site instead of
having to change it on every page like I would if I had embedded it. Any
examples of how to handle this the "correct" or ideal way in ASP.NET would
be MUCH APPRECIATED. Thank you.
 
You can implement a so-called "User Control". It works approximately
like this:

<%@ Register TagPrefix="myctl" TagName="Footer" Src="footer.ascx" %>
.... Later on: ...
<myctl:Footer id="footer1" runat="server" />

Use the keyword "User Control" to find it in the documentation pages.

Good luck!
 
Are there any samples like in the VB.NET resource kit or somewhere else
somecan can point me to where I can get a good look at how the site
navigation html source can be centralized in one location/class/file?
 
Back
Top