Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5549
Hide items on templated Webdatamenu
posted

hi, i have the following sample on my page. how can i now (on pageload?) hide items of the menu so the will not shown ?  

here for example to don't wanna show the second menupoint

<ig:webdatamenu ID="WebDataMenu1" runat="server" StyleSetName="RedPlanet"
            Width="100%">
            <Items>
                  <ig:DataMenuItem Text="employee">
                    <Items>
                        <ig:DataMenuItem Text="employee1">
                            <Template>
                                <asp:HyperLink CssClass="igdm_RedPlanetMenuItemVertical" ID="employee2" runat="server" NavigateUrl="~/employee3.aspx">employee</asp:HyperLink>
                            </Template>
                        </ig:DataMenuItem>
                        <ig:DataMenuItem Text="employee4">
                            <Template>
                                <asp:HyperLink CssClass="igdm_RedPlanetMenuItemVertical" ID="employee5" runat="server" NavigateUrl="~/employee7.aspx">employee8</asp:HyperLink>
                            </Template>
                        </ig:DataMenuItem>
                    </Items>
                </ig:DataMenuItem>

Parents
No Data
Reply
  • 4493
    Suggested Answer
    posted

    Hello,

    The WebDataMenuItem does not support Visibility property. However on PageLoad you can remove the unwated items from Items collection of the menu:

    1. If you want to remove Root level item use this: 
    this.masterMenu.Items.RemoveAt(2);

    2. If you want to remove any other level item, you can use this:
    this.masterMenu.Items[2].Items.RemoveAt(2);

    Note that in both cases Items is zero-based-index collection, in which items appear in the order you have put them in the markup. Also that any DataMenuItem has this Items property. You may want to check the ".Count" property of Items, before taking actions over it.

    Items property is of type DataMenuItemsCollection.

    Hope this helps

Children