|
In the following example we are going to show you how to make the best use of dynamic and static menus:
In Microsoft Visual Studio 2005, create a new website and add the Menu control to your page. This control can be found in your tool box under the Navigation section.
The Menu control in ASP.NET 2.0 has (like many other standard ASP.NET controls) an items property by which you can set the items tree to be displayed by the menu. So, Locate the items property of your Menu control and click it and set your items tree as in figure 1. You typically add new items using the two ' Add a root item ', and ' Add a child item ' buttons in the top left corner of the ' Menu Item Editor ' and then set the item text via it's Text property to the right.
 |
|
Figure 1: Menu Item Editor |
Now run your webpage and see how the menu will be displayed in figure 2. As you can see this is a dynamic menu (not all items are displayed all the time). It's obvious that you will need to put your mouse cursor on this menu to open it before you can click any of it's items (figure 3).
 |
|
Figure 2: Simple menu |
 |
|
Figure 3: Menu with sub menus |
Having learned how to produce a dynamic menu you are now ready to explore the other side of the story: the static menus. You need to know nothing new to achieve this behavior except for the use of the StaticDisplayLevels property. Using this property you can simply set how much levels of your menu you want to be displayed as static. For example if we to set this property to 3 then all of our levels will be displayed as static and the menu will appear as depicted in figure 4. It's worth noting here that we never positioned our mouse pointer on figure 4 to produce this effect, that was totally done by default.
|

|
|
Figure 4: Static complex menu |
one last property is worth mentioning here. It's the NavigateUrl property by which you can define what will be the URL (i.e., the web page) to which the end user browser will be directed when a given menu item is clicked. You will find this property among the menu items properties in the ' Menu Item Editor ' window.
|