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

Disable Menu Item from another page when called

5 Answers 116 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Wendy Hunt
Top achievements
Rank 2
Wendy Hunt asked on 24 Feb 2010, 07:34 PM
Hi -

I have a button, that when clicked... I want it to disable the menu until an action is taken, then have the menu operational (enabled) again by clicking a different button.  The purpose of my actions is to not let the user navigate off the page until they have finished editing and then have saved their work. 

I have been going through the postings and haven't found anything that works (I've tried many examples...Visible...EnableSelection...Enabled...etc). 

My menu is located on the Master page, and my calling code is located on the SOI page.

Here is the code I have so far...
      private void EnableNavigation(bool enabled)  
      {  
        RadMenu menu = (RadMenu)(Master.FindControl("RadMenu1"));  
        menu.Enabled = enabled;  
      } 

This is how I call it from my Edit button click method... 
EnableNavigation(false);

Any other suggestions?  Should I be going about this in a different way?

wen

5 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 25 Feb 2010, 02:48 PM
Hello Wendy,

This approach seems correct.

Greetings,
Yana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Wendy Hunt
Top achievements
Rank 2
answered on 25 Feb 2010, 02:53 PM
Do you think I should put in a support ticket, if it should be working but isn't?

wen
0
Yana
Telerik team
answered on 25 Feb 2010, 02:57 PM
Hi Wendy,

I'm sorry I didn't understand that this doesn't work.
Could you please prepare a simple page demonstrating the issue and send it in the support ticket so we to be able to test it? Thanks in advance.

Kind regards,
Yana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Liz
Top achievements
Rank 1
answered on 02 May 2013, 05:32 PM
I am experiencing a very similar issue. I originally on initialization of the RadMenu set a menu item to be Enabled = false;

RadMenu menu = new RadMenu();
menu.Value = "Menu";
RadMenuItem toggledMenuItem = new RadMenuItem("Save File");
toggledMenuItem.Value = "ToggledMenuItem";
toggledMenuItem.Enabled = false;

I can successfully change the value of Enabled to be true when a different variable is populated using the following code: 

RadMenu foundMenu = FindControl("Menu") as RadMenu;
RadMenuItem foundMenuItem = foundMenu.FindItemByValue("ToggledMenuItem");
... // null checks
foundMenuItem.Enabled = true;

However, even with Enabled = true, the menu item is still displaying as disabled. Is there some sort of UI refresh that needs to occur in order to enforce the change?
0
Kate
Telerik team
answered on 07 May 2013, 12:10 PM
Hello Liz,

I tested the scenario that you describe but I was not able to replicate the issue that you are getting. attached to this post you can find my testing page. Please give it a try and let me know how it goes from your side. Can you also modify it in a way that it demonstrates the issue that you have and send it back to me so I can observe it from my side? 

All the best,
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
Wendy Hunt
Top achievements
Rank 2
Answers by
Yana
Telerik team
Wendy Hunt
Top achievements
Rank 2
Liz
Top achievements
Rank 1
Kate
Telerik team
Share this question
or