Previously, I thought that the menus were all made through sitemap. Recently, the method in the project was determined by using the XmlDataSource list.
Menusite. xlm file:
Copy codeThe Code is as follows:
<? Xmlversion = "1.0" encoding = "UTF-8"?>
<Menusvalue = "">
<TopMenuid = "100" value = "" ImageUrl = "~ /App_Themes/Public/images/PublicImages/topMenu_stl.jpg "NavigateUrl =" ">
<TopMenuItemid = "101" value = "applyfortertermleaseofstateland" NavigateUrl = "~ /TOL/Issuance/AppTOLApplication. aspx "> </TopMenuItem>
<TopMenuItemid = "102" value = "ManageMyExistingAccount" NavigateUrl = "~ /CaseEnquiry/HomeAuthenticate. aspx? ShowPanel = true "> </TopMenuItem>
<TopMenuItemid = "103" value = "ViewMessagesforMyApplications" NavigateUrl = "~ /CommonUtility/Email/listappcorresponsor. aspx "> </TopMenuItem>
</TopMenu>
<TopMenuid = "200" value = "" ImageUrl = "~ /App_Themes/Public/images/PublicImages/topMenu_aosl.jpg "NavigateUrl =" ">
<TopMenuItemid = "202" value = "ManageMyExistingStateTitle" NavigateUrl = ""> </TopMenuItem>
<TopMenuItemid = "203" value = "ViewMessagesforMyApplications" NavigateUrl = ""> </TopMenuItem>
</TopMenu>
<TopMenuid = "300" value = "" ImageUrl = "~ /App_Themes/Public/images/PublicImages/topMenu_lup.jpg "NavigateUrl =" ">
<TopMenuItemid = "301" value = "SubmitProposalforLandUse" NavigateUrl = ""> </TopMenuItem>
</TopMenu>
<TopMenuid = "500" value = "" ImageUrl = "~ /App_Themes/Public/images/PublicImages/topMenu_logout.jpg "NavigateUrl = "~ "Logout. aspx">
</TopMenu>
</Menus>
Create the xmldatasource and asp: menu controls in html:
Copy codeThe Code is as follows:
<Asp: xmlperformanceid = "xmlperformance1" runat = "server" DataFile = "Menusite. xml"> </asp: XmlDataSource>
<Asp: MenuDataSourceID = "XmlDataSource1" runat = "server" ID = "Menu1" MaximumDynamicDisplayLevels = "4"
Orientation = "Horizontal" StaticDisplayLevels = "2" StaticEnableDefaultPopOutImage = "False"
DynamicEnableDefaultPopOutImage = "false" StaticSubMenuIndent = "" ItemWrap = "True">
<DataBindings>
<Asp: MenuItemBindingDataMember = "TopMenu" ImageUrlField = "ImageUrl" TextField = "value"
NavigateUrlField = "NavigateUrl" ValueField = "value"/>
<Asp: MenuItemBindingDataMember = "TopMenuItem" NavigateUrlField = "NavigateUrl" TextField = "value"
ValueField = "value"/>
<Asp: MenuItemBindingDataMember = "Menus" TextField = "value" ValueField = "value"/>
</DataBindings>
</Asp: Menu>
Menu is indeed comprehensive. You only need to set properties to meet your requirements without any code:
MaximumDynamicDisplayLevels: specifies the number of layers of dynamic display menu nodes that should be displayed after the static display layer. If it is set to 0, the subnode will not be dynamic.
Orientation: used to set a horizontal menu bar on the page.
StaticDisplayLevels: number of layers of the statically displayed menu from the root menu. The preceding tips are as follows: xml must have a root node, but the Level 2 menu item must be displayed when the menu is displayed.
Set the value of the root node of xml to null, and set saticDisplayLeves to 2. In this way, the second layer of static display is displayed.
StaticEnableDefaultPopOutImage: the static menu item displays a small arrow by default. If it is set to false, this state will be changed.
DynamicEnableDefaultPopOutImage: sets whether the dynamic display has a small arrow.
StaticSubMenuIndent: controls the indent depth of sub-menu entries if these menu levels are set to be displayed in static mode.
ItemWrap: sets whether menu items can wrap.
With the above settings, you can easily create the desired menu style.