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

keep menu open

6 Answers 106 Views
Menu
This is a migrated thread and some comments may be shown as answers.
cprieto
Top achievements
Rank 1
cprieto asked on 08 Sep 2008, 05:41 PM
Hello,

I've been trying to keep a menu open after a selection of an item (the menu has checkbox stuff and I need to allow the user to select the items before close it).

So far I only can get that behavior creating a fake function and generating a javascript error:

<telerik:RadContextMenu ID="contextColumns" runat="server" Flow="Vertical" Skin="Hay" OnClientItemClicked="OnMenuClick"
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        <Items> 
            <telerik:RadMenuItem runat="server" Text="Show Columns" Value="Columns"
                <Items> 
                    <telerik:RadMenuItem runat="server" Text="Id" State="checked" /> 
                    <telerik:RadMenuItem runat="server" Text="First Name" State="checked" /> 
                    <telerik:RadMenuItem runat="server" Text="Last Name" State="checked" /> 
                    <telerik:RadMenuItem runat="server" IsSeparator="true" /> 
                    <telerik:RadMenuItem runat="server" Text="Apply" Value="menuApply" /> 
                </Items> 
            </telerik:RadMenuItem> 
            </telerik:RadMenuItem> 
        </Items> 
</telerik:RadContextMenu> 

And this is the way I try to do it in js:

function OnMenuClicked(sender, args) { 
   var item = args.get_item(); 
   switch(item.get_value()) { 
       case "menuApply" : 
          // Here I need to apply changes and that's all 
       break
       default : 
          ToggleCheckImage(item); 
          this_function_does_not_exists();  // the only way to keep the menu open 
   } 

The user need to select the items in the menu and then apply the changes when select "Apply", the only way I could keep the menu open until the user select apply is using a simple javascript error.

Is any better way to do what I want? just to keep the menu displayed until the user select the correct menu option?

Thanks a lot for your help!


6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 09 Sep 2008, 12:08 PM
Hi kementeus,

RadContextMenu does not support this scenario. Clicking an item is always closing the menu.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Daniel Plomp
Top achievements
Rank 2
answered on 12 Sep 2008, 03:39 PM
I have also asked this question long time ago. I've another situation where I need such functionality.

Isn't it possible to fire a javascript e.g. to expand the menu after the page_load?

I would really like some help regarding this issue.

Thanks,
Daniel
0
Atanas Korchev
Telerik team
answered on 15 Sep 2008, 08:33 AM
Hello Daniel,

We have this online demo which shows how to open a menu after postback.

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Daniel Plomp
Top achievements
Rank 2
answered on 15 Sep 2008, 09:23 AM
Hi Albert,

Thanks for the info.
However, is it possible to do this automatically? So when a menu item is pressed, the script fires?

Daniel
0
Atanas Korchev
Telerik team
answered on 15 Sep 2008, 10:33 AM
Hi Daniel,

You can modify the example to do so. For example you can use this code in the ItemClick event handler of your menu:

ScriptManager.RegisterHiddenField(this, "HiddenField1", e.Item.Text);

Regards,
Albert
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Daniel Plomp
Top achievements
Rank 2
answered on 15 Sep 2008, 10:39 AM
Okay, thanks. I will try to figure it out. I'm using the r.a.d.menu in Sitefinity, so that probably works something different.

Daniel
Tags
Menu
Asked by
cprieto
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Daniel Plomp
Top achievements
Rank 2
Share this question
or