Howto use StaticDisplayLevels?

Last post 11-03-2009 3:28 AM by JohnGH. 0 replies.

Sort Posts:

  • Howto use StaticDisplayLevels?

    11-03-2009, 3:28 AM
    • Member
      point Member
    • JohnGH
    • Member since 11-03-2009, 3:20 AM
    • Posts 1

    Can someone please explain how to use StaticDisplayLevels with the CSSAdapters?

    I'm using build 24242.

    So what css adjustment is needed to show for example:

    Menu code:

    <asp:Menu ID="EntertainmentMenu" runat="server" Orientation="Horizontal" onmenuitemclick="OnClick" CssSelectorClass="SimpleEntertainmentMenu" StaticDisplayLevels="2">
    <Items>
    <asp:MenuItem Text="Home">
    <asp:MenuItem Text="Music">
    <asp:MenuItem Text="Classical" />
    <asp:MenuItem Text="Rock">
    <asp:MenuItem Text="Electric" />
    <asp:MenuItem Text="Acoustical" />
    </asp:MenuItem>
    <asp:MenuItem Text="Jazz" />
    </asp:MenuItem>
    <asp:MenuItem Text="Movies" Selectable="false">
    <asp:MenuItem Text="Action" />
    <asp:MenuItem Text="Drama" />
    <asp:MenuItem Text="Musical" />
    </asp:MenuItem>
    </asp:MenuItem>
    </Items>
    </asp:Menu>

    It should return Home Music and Movies as static Items. I couldn't figure out to do it with just css.

    Now I replaced a bit inside the BuildItem function:

    if ((item.ChildItems != null) && (item.ChildItems.Count > 0))
    {
    BuildItems(item.ChildItems, false, writer);
    }


    replaced by:
    if ((item.ChildItems != null) && (item.ChildItems.Count > 0))
    {
    if (item.Depth + 1 < menu.StaticDisplayLevels)
    {
    foreach (MenuItem statItem in item.ChildItems)
    {
    BuildItem(statItem, writer);
    }
    }
    else
    BuildItems(item.ChildItems, false, writer);
    }

    But I guess it should be possible to keep the code standard, right??


Page 1 of 1 (1 items)