asp.net2.0Menu问题
我在做了一个菜单导航:
代码如下:1.前台
<table style= "width:100% ">
<tr>
<td align= "right " valign= "top ">
<asp:Menu ID= "ManageMenu " runat= "server " ToolTip= "Manage " OnMenuItemDataBound= "ManageMenu_MenuItemDataBound " OnInit= "ManageMenu_Init " OnMenuItemClick= "ManageMenu_MenuItemClick " DataSourceID= "SamplesSiteMap ">
<StaticItemTemplate>
<asp:LinkButton ID= "LinkButton1 " runat= "server " CommandName= ' <%# Eval( "Text ") %> '
Text= ' <%# Eval( "Text ") %> ' OnClick= "LinkButton1_Click "> </asp:LinkButton>
</StaticItemTemplate>
<DynamicItemTemplate>
<asp:LinkButton ID= "LinkButton1 " runat= "server " CommandName= ' <%# Eval( "Text ") %> '
Text= ' <%# Eval( "Text ") %> '> </asp:LinkButton>
</DynamicItemTemplate>
</asp:Menu>
<asp:SiteMapDataSource ID= "SamplesSiteMap " runat= "server " SiteMapProvider= "SamplesSiteMap "/>
</td>
</tr>
</table>
说明:我的Menu绑定到了一个SamplesSiteMap.sitemap上面.
当然我已经事先在web.config上面配置过了文件如下:
<system.web>
<siteMap defaultProvider= "SamplesSiteMap ">
<providers>
<add name= "SamplesSiteMap " type= "System.Web.XmlSiteMapProvider " siteMapFile= "~/Admin/Skin/Banner/QuickMenu.sitemap "/>
</providers>
</siteMap>
</system.web>
2.sitemap代码:
<?xml version= "1.0 " encoding= "utf-8 " ?>
<siteMap xmlns= "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0 " >
<!--Management-->
<siteMapNode url= " " title= "Management " description= " " roles= "3 ">
<!--Page Function-->