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. :)
What do you mean by part of the WebDataMenu? Because by setting Visible false to any group of items will make part of the items hidden while the other part visible. Can you give a concrete example?
Thanks for your patience with me, Lubomir. I'm probably missing something simple.
Here's an example of my WebDataMenu implementation (using an XmlDataSource):
<ig:WebDataMenu ID="wdmSite" runat="server" DataSourceID="MainMenuSource" EnableScrolling="false" MaxDataBindDepth="3" ScrollingSpeed="VeryFast">
<GroupSettings Orientation="Horizontal" />
<DataBindings>
<ig:DataMenuItemBinding DefaultText=" " TextField="text"
ValueField="value" ImageUrlField="imageurl"
ToolTipField="text" NavigateUrlFields="url" />
</DataBindings>
</ig:WebDataMenu>
You can see the result of this WebDataMenu at: http://www.apesoftware.com/.
Note that you can see four nodes without sign in (i.e., home, products, iso 9000, and forum). When you sign in (email: test@test.com, password: Test85), an apparent 5th node (your account) becomes visible. In truth, this is not a 5th node but a completely new WebDataMenu, which is my workaround to not knowing how to make individual top nodes visible (or not).
Does that help?
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.
Fantastic! That's exactly what I needed.
Thank you Lubomir! :)
Please let me know if you need any further assistance with this matter.
Sincerely,TroyDeveloper Support Engineer
Will do and thanks for the help. :)