I'm using the WebDataMenu 10.3 in a .NET 4 environment. The menu uses an XmlDataSource.
How can I programatically show or hide major elements of the menu. Currently, I am using three WebDataMenus on the same page and manipulating the visibility of the second and third menus based on the visitor privileges.
For a specific example, I am referring to the dropdown menus (WebDataMenus) implemented on my site at: http://www.apesoftware.com/
Any help is appreciated! :)
Hi Mark,
if you want to show/hide element on the server side use the DataMenuItem.Visible property. This should work just fine.
Let me know whether this is what you need.
Thanks,
Lubomir
Thanks for the response, Lubomir.
Actually, I'm using the Visible property to make the second and third menus visible or not.
What I need is a method to make part of a WebDataMenu visible or not. :)
Hi, I want to hide the following element in WebDataMenu:
<Menu ID="5.2" Value="TravelMode" Url=""> <Menu ID="5.2.1" Value="Bus" Url="~/bus.aspx" /> <Menu ID="5.2.2" Value="Train" Url="~/train.aspx" /> <Menu ID="5.2.3" Value="Car" Url="~/car.aspx" /> </Menu> <Menu ID="5.3" Value="Flight" Url="~/flight.aspx" /> I Want to Hide 5.3 i.e. Flight , Kindly let me know how to proceed
<Menu ID="5.2" Value="TravelMode" Url=""> <Menu ID="5.2.1" Value="Bus" Url="~/bus.aspx" /> <Menu ID="5.2.2" Value="Train" Url="~/train.aspx" /> <Menu ID="5.2.3" Value="Car" Url="~/car.aspx" /> </Menu> <Menu ID="5.3" Value="Flight" Url="~/flight.aspx" />
I Want to Hide 5.3 i.e. Flight , Kindly let me know how to proceed
Will do and thanks for the help. :)
Please let me know if you need any further assistance with this matter.
Sincerely,TroyDeveloper Support Engineer
Fantastic! That's exactly what I needed.
Thank you Lubomir! :)
now I get what do you mean. I don't think you need to render separate menu control, unless you aim at bigger security.
As I see you data bind the menu to a data source. I advise you to subscribe for the OnDataBound event of the control and then in the event handler say wdmSite.Items[4] .Visible = false; This should hide the last root item for the account. When you log in the user then you can set the corresponding item to Visible = true.
But setting Visible to false will still render the item on the client it just will be no visible. So a smart hacker can view the page source and see the links of the hidden menu and eventually try to access them, so you have do checks for user log in on those pages that require the user to be logged in.
Hope this helps.