Building a Data-Driven Navigation Menu
Navigation menus are the forefront of just about any website, whether the site is a dynamic database driven application or simply a personal homepage. They lead and direct your user around the pages of your site and provide the basis for your usability experience. A site that is difficult to navigate is a site that will not be popular with your users.
When working with ASP.NET you have a lot of extra flexibility when working with a navigation menu. In most development languages, your menu needs to be copied/pasted onto all of your pages, or at the very least you had to use include statements to place the menu at the top of every page. This process is very redundant and cumbersome.
ASP.NET offers the ability to create user controls, which are custom chunks of HTML and code-behind server logic which can be dragged/dropped onto any .aspx Web form in your application, making the development of a component such as a navigation menu quite easy, and very reusable.
In addition to a custom user control, you can add in your own server logic to extend the menu control even further and allow it to be data-driven from a database of your choice. This way your menu is rendered on-the-fly dynamically from records read from a database table which can be modified in real time.
In this tutorial we will build a sample application to demonstrate this powerful technique. We will build a custom user control to house our navigation menu which can be dropped onto any page in our application. And we will implement functionality to make our user control database driven from an Access .mdb database, rendering menu items and submenu items dynamically.
Note: This tutorial requires Visual Studio .NET and if you wish to change/customize the database provided you will also need Microsoft Access.
Kevin Koch is a senior software engineer with over 8 years experience designing and architecting primarily web based applications. Fresh out of college during the nineties he co-founded Task Solutions and developed several projects with the then popular classic ASP.
During the Dot Com boom Kevin left his position as president and joined a new venture to build an enterprise insurance claim system build upon J2EE technology. After the Dot Com crash Kevin schooled himself to become an expert with .NET technology and is currently freelancing his ASP.NET skills to build enterprise n-tier frameworks using advanced OO methodologies.
You must me logged in to write a review.