ASP.NET Breadcrumbs with C#
By utilizing breadcrumb navigation you allow your viewers to easily trace their path taken to the current location and back track if necessary.
A breadcrumb navigation usually looks something like:
Main Page > Page Design : ASP.NET Breadcrumbs with C#
Within this article you will learn how to create breadcrumb navigation using ASP.NET and C#.
In the above example we see that the viewer started on the ’Main Page’, then moved to the ‘Page Design’ section, then selected the ‘ASP.NET Breadcrumbs with C#’ page, where they currently reside. The Main Page and Page Design will be hyperlink so that you can go directly to the above sections.
The first part, ‘Main Page’ is where the user is starting; typically something like ‘Home’ or ‘Home Page’ will be used. However, we will use a variable in our code so that the user may decide what text they would like to use. The next part ‘Page Design’ is a sub-category that holds the page that the user is currently viewing, ‘ASP.NET Breadcrumbs with C#’. We know that this is the final resting spot because the ‘:’ preceding the page name indicates so. Finally, the ‘>’ is used as a separator for categories, this also is a variable, allowing for a choice of symbol.
The HTML writer to write out to
We are going to use an ASP.NET User control (.ascx) so that we may simply add this control to our pages making it easy to maintain and modify later if we should choose to. For example, if we have 100 pages and we want to modify the separator in our breadcrumb navigation from the “>†symbol to an image we will only have to modify 1 page, our .ascx page and not all 100 .aspx pages.
Creating Our Web Pages (.aspx). For each page (.aspx) you create for your website use a literal . This allows us to define the actual title for our page in the code behind. By defining the title of the page in the code behind we gain the benefit of only having to assign it once and have it not only be used for the title of our page, but also be used in our breadcrumb navigation.
Your code behind would look like this:
We created a class for our breadcrumb navigation and used that class for an ASP.NET User control (.aspx). This allows us to simply drop the User control into each web page (.aspx) we create. Once we have our User control in our page we assign the PageTitle in the code behind and this gets used for the site.
Copyright @ Abhishek Arya 2007

- Web Design for My Chemical Romance Rock Band
- City in the sunshine effect
- How to make your Twins | Multiply yourself
- Mysterious hell gate, the connection between two worlds
- Feather under the water, a beautiful effect
- Super mysterious lighting effects for your image
- Impressive typography for games
- ASP.NET Breadcrumbs with C#
- Realistic denim (jean) texture from scratch
- Tuning Ubuntu on a Macintosh










Tags:
4,284 views
2 Comments
(5 votes, average: 4.8 out of 5)
2 Comments
Jump to comment form | comments rss [?] | trackback uri [?]