Go to: |
Tools, Configure Menu… |
Multi-level menus provide pull-down (hierarchical) menus for site navigation in your application. Multi-level menus use the ASP.NET menu control to provide this feature. Iron Speed Designer has a convenient built-in wizard to help you configure multi-level menus. It’s the easiest and best way to configure multi-level menus.
You can rearrange menu items at any level simply by dragging and dropping them to their new locations withing the menu tree in the wizard. You can also copy and paste them to create duplicate menu items for further configuration.
Menu sitemap files
ASP.NET multi-level menus are controlled by a Site Map file, which is an XML containing all the menu items organized hierarchically. Iron Speed Designer creates separate sitemap files for each menu control created in your application. Once your application is created, you may edit the sitemap file either in Iron Speed Designer via the Configure Menu wizard (recommended) or externally as an XML file.
You can add as many multi-level menu controls to your application as you wish by dragging a menu from the Toolbox onto your page. The sitemap file for each menu control should be placed in the same location as menu control file (.ASCX file).
Here is an example sitemap file:
<siteMap>
<siteMapNode>
<siteMapNode title="Categories" description="Categories" roles="">
<siteMapNode title="{Menu:Add} Categories" description="{Menu:Add} Categories" url="~/Categories/AddCategories.aspx" roles="" />
<siteMapNode title="{Menu:Edit} Categories" description="{Menu:Edit} Categories" url="~/Categories/EditCategories.aspx" roles="" />
<siteMapNode title="{Menu:Show} Categories" description="{Menu:Show} Categories" url="~/Categories/ShowCategories.aspx" roles="" />
</siteMapNode>
</siteMapNode>
</siteMap>
All sitemap files should contain a root element called <siteMap>. There can be only one siteMapNode element under the root <siteMap> element. You can create a menu hierarchy of any depth by nesting siteMapNode elements. Each siteMapNode tag represents a menu item in the menu control.
Sitemap file tags
The tags are case-sensitive and should contain the following case-sensitive attributes:
Attribute |
Description |
description |
The tool tip displayed for the menu item. Surround any part of the title to be retrieved from a RESX resource file with curly braces, {}. description="{Menu:Add} Categories" |
order |
The order is used by Iron Speed Designer when adding new menu items. It does not have any effect on the order of the menu items at application run-time. |
roles |
A list of comma separated roles defined as part of your application's security. See Specifying Security Roles for Multi-Level Menus for details. |
title |
The text displayed for the menu item. Surround any part of the title to be retrieved from a RESX resource file with curly braces, {}. title="{Menu:Add} Categories" |
url |
The url value may be an empty string or may contain a unique value. The value should be one of the following types: Absolute URL The complete path of the web page you want to display, e.g.: http://www.ironspeed.com Relative URL The URL relative to application’s root folder, e.g.: ~/Categories/ShowCategoriesTable.aspx Duplicate URLs not allowed The ASP.NET multi-level menu control does not allow for two identical URL links to be contained in the sitemap file. In some cases you may need to append a ‘?’ character to a URL if you have two menu items that reference the same URL (web page), e.g.: ~/Categories/ShowCategoriesTable.aspx and ~/Categories/ShowCategoriesTable.aspx? To pass URL parameters, append the “?” character to the URL followed by one or more parameters, e.g.: ~/Categories/ShowCategoriesTable.aspx?CategoryID=2 To pass multiple parameters, place “&” between parameters, e.g.: ~/Categories/ShowCategoriesTable.aspx?CategoryID=2&CategoryName=Beverages1 Only constant values can be passed as parameter values in .sitemap files. Dynamic parameter values cannot be passed through .sitemap files. |
Duplicate URLs
The Microsoft ASP.NET menu control does not permit duplicate URLs in sitemap files. This is a Microsoft restriction. However, you can add a question mark ("?") followed by an unused parameter to create unique URLs that have the same function, e.g., "?foo=bar".
Highlighting parent menu items
Unfortunately, the ASP.NET multi-level menu control does not directly support highlighting parent menu items. There are solutions posted on the Web that require code changes and some JavaScript, e.g.:
http://www.codeproject.com/KB/webforms/AspMenuParentHighlighting.aspx
Related Microsoft topics
Sitemap files: http://msdn2.microsoft.com/en-us/library/yy2ykkab.aspx
ASP.NET menu controls: http://msdn2.microsoft.com/en-us/library/yy2ykkab.aspx
Sitemap providers: http://msdn2.microsoft.com/en-us/library/ms178426.aspx