将 DevExpress 菜单绑定到 SiteMap 的根节点问题
我有一个通过标准 asp:SiteMapDataSource
控件绑定到我的 Web.sitemap 文件的 ASPxMenu。菜单应该是水平的,就像我的主顶部菜单一样。菜单和项目如下:
<dx:ASPxMenu ID="topMainMenu" runat="server" Orientation="Horizontal"
DataSourceID="siteMapDataSource" RenderMode="Lightweight">
</dx:ASPxMenu>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="" >
<siteMapNode url="~/Default.aspx" title="Home" description="Home page."></siteMapNode>
<siteMapNode url="~/Products/Main.aspx" title="Products & Services" description="Main product catalogue."></siteMapNode>
<siteMapNode url="~/About.aspx" title="About Us" description="Company profile." />
</siteMapNode>
</siteMap>
我的问题是,当菜单呈现时,我只获得根项目,而我想要的所有项目都在其下方的下拉菜单中。我不需要根项目,我想要水平菜单中的所有其他项目。在我自己的菜单代码中,我有一个 RenderRootNode 标志,但这不是这里的选项。
如果我使用像这样的普通 ASP.NET 菜单控件...
<asp:Menu ID="topMainMenu" runat="server" Orientation="Horizontal"
DataSourceID="siteMapDataSource" StaticDisplayLevels="2">
<LevelMenuItemStyles>
<asp:MenuItemStyle Font-Underline="False" Width="0px" />
</LevelMenuItemStyles>
</asp:Menu>
... StaticDisplayLevels="2"
属性设置可以纠正此问题,但我在 DevExpress 上找不到这样的设置菜单。也许它只是在数以百万计的人中迷失了?
I have an ASPxMenu bound to my Web.sitemap file through a standard asp:SiteMapDataSource
control. The menu is supposed to be horizontal, as my main top menu. Menu and items are as follows:
<dx:ASPxMenu ID="topMainMenu" runat="server" Orientation="Horizontal"
DataSourceID="siteMapDataSource" RenderMode="Lightweight">
</dx:ASPxMenu>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode title="" >
<siteMapNode url="~/Default.aspx" title="Home" description="Home page."></siteMapNode>
<siteMapNode url="~/Products/Main.aspx" title="Products & Services" description="Main product catalogue."></siteMapNode>
<siteMapNode url="~/About.aspx" title="About Us" description="Company profile." />
</siteMapNode>
</siteMap>
My problem is that when the menu renders, I only get the root item, and all the items I want are in a drop down menu below that. I don't want the root item, and I want all the other items in a horizontal menu. In my own code for my own menus, I have a RenderRootNode flag, but that isn't an option here.
If I use a vanilla ASP.NET Menu control like this...
<asp:Menu ID="topMainMenu" runat="server" Orientation="Horizontal"
DataSourceID="siteMapDataSource" StaticDisplayLevels="2">
<LevelMenuItemStyles>
<asp:MenuItemStyle Font-Underline="False" Width="0px" />
</LevelMenuItemStyles>
</asp:Menu>
... the StaticDisplayLevels="2"
attribute setting corrects this problem, but I can find no such setting on the DevExpress menu. Maybe it's just lost among all the millions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 siteMapDataSource.ShowStartingNode 属性设置为 false 可解决此问题。
Set the siteMapDataSource.ShowStartingNode property to false to resolve this issue.