开发者

Root node problem binding DevExpress menu to a SiteMap

开发者 https://www.devze.com 2023-01-26 07:32 出处:网络
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:

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 &amp; 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 n开发者_JS百科o such setting on the DevExpress menu. Maybe it's just lost among all the millions?


Set the siteMapDataSource.ShowStartingNode property to false to resolve this issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消