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

Close menu after click

3 Answers 92 Views
Menu
This is a migrated thread and some comments may be shown as answers.
iomega 55
Top achievements
Rank 1
iomega 55 asked on 12 Aug 2009, 10:47 PM
Hi:

How can I parametrize the radmenu so when I click an option, the menu closes after it immediatly?

At this moment when I click an option, and the mouse remains over the menu, the menu continues open, but I want it closes after it has been clicked.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 13 Aug 2009, 06:28 AM
Hello,

Try the following client side code for closing all the menu items on clicking an item by attaching the OnClientItemClicked event and explicitly closing the subitems.

JavaScript:
 
<script type="text/javascript"
function OnClientItemClicked(sender, eventArgs) 
    sender.close(); 
</script> 

-Shinu.
0
Adam Haid
Top achievements
Rank 1
answered on 11 Feb 2011, 12:54 AM
This doesn't work if you call eventArgs.set_cancel(true); in the same function.I'm trying to open a RadWindow then close the menu. If I don't set_cancel(true) then the page posts back and my RadWindow closes. When I call sender.close() after opening the RadWindow it doesn't close the window. Can someone help me keep my RadWindow open and still close the RadMenu?
 function MenuItemClicked(sender, eventArgs) {
                    switch (eventArgs.get_item().get_text()) {
                        case "Create New Ticket":
                            openNewWindow();
                            eventArgs.set_cancel(true);
                            sender.close();
                            break;
                        case "View Alert Documentation":
                            return false;
                            break;
                    }
                }
                function openNewWindow() {
                    var oWnd = radopen("http://www.google.com", "radWindow");
                    oWnd.center();
                }

<telerik:RadContextMenu ID="RadMenu1" runat="server" OnItemClick="RadMenu1_ItemClick" OnClientItemClicked="MenuItemClicked"
            EnableRoundedCorners="true" EnableShadows="true">
            <Items>
                <telerik:RadMenuItem Text="Create New Ticket" ImageUrl="" Value="Create"/>
                <telerik:RadMenuItem Text="View Alert Documentation" ImageUrl="" Value="View"/>
                <telerik:RadMenuItem Text="Clear Alert" ImageUrl="" Value="Clear"/>
            </Items>
        </telerik:RadContextMenu>
    <telerik:RadWindowManager ID="RadWindowManager" ShowContentDuringLoad="false" VisibleStatusbar="false"
         runat="server" EnableShadow="true">
        <Windows>
            <telerik:RadWindow runat="server" ID="radWindow"></telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
0
Elena
Top achievements
Rank 1
answered on 14 Aug 2015, 03:30 PM
Thank you so mu
Tags
Menu
Asked by
iomega 55
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Adam Haid
Top achievements
Rank 1
Elena
Top achievements
Rank 1
Share this question
or