This is a migrated thread and some comments may be shown as answers.

RadMenuItem Visible Not Working

3 Answers 163 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 16 Mar 2012, 07:39 PM

I'm trying to set the visiblity of a RadMenuItem based on code.  I've seen some other posts but they seem rather difficult or sloppy to maintain.  My end goal is to run it through a function that will return true or false.  I've simplified it for discussion purposes. 

This code below should work.  But it doesn't.  Any ideas?

<telerik
:RadMenuItem runat="server" NavigateUrl="~/users/manage_users.aspx" Text="Users" Visible='<%# "false" %>'>

</telerik:RadMenuItem>



I don't get an error but the menu item still shows.

Any ideas?

Thanks,
Rob

3 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 21 Mar 2012, 03:30 PM
Hi Rob,

Thank you for contacting us.

Can you elaborate a bit more on your scenario? Do you need to use a binding expression that will take a particular value from your database and assign it to the Visible property or you are trying to assign a simple value to this property?  

Greetings,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Rob
Top achievements
Rank 1
answered on 25 Mar 2012, 09:42 PM
In this scenario, I want to use Roles to show/hide the visible property.  Some links are for Admin only.  Some links are for Sales people only, etc...
0
Kate
Telerik team
answered on 28 Mar 2012, 12:48 PM
Hi Rob,

I am not quite sure about the approach that you use in order to hide/show menu items depending on the different user roles but I can suggest few post where a very similar functionality is implemented. For example  the following post explains in details how you can achieve the desired logic: Can i hide/ show asp:Menu items based on role? Since this article is related to the asp menu control, however, I would also suggest that you use any of the properties described in the following help article Accessing Items to find the menu items that needs to be hidden/shown when a user logs as a different role.

Kind regards,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Menu
Asked by
Rob
Top achievements
Rank 1
Answers by
Kate
Telerik team
Rob
Top achievements
Rank 1
Share this question
or