RadMenu ClickToOpen and Close it after MenuItem Clicked

7 posts, 1 answers
  1. Kiresh
    Kiresh avatar
    24 posts
    Member since:
    Sep 2012

    Posted 01 Aug 2013 Link to this post

    Hello Everyone,

    i want to close Menu-items after clicked on any MenuItems using javscript  OnClientItemClicked.

    and my RadMenuItems are under

    <telerik:GridTemplateColumn >
                            <ItemTemplate>
                         <telerik:RadMenu ID="RadMenuClient" runat="server" EnableRoundedCorners="true" EnableShadows="true"
                                OnClientItemClicked="OnClientItemClicked" ExpandAnimation-Type="None" CollapseAnimation-Type="None"
                                ExpandDelay="0" CollapseDelay="0" Selected="false" ClickToOpen="true">
                                <Items>
                                  <telerik:RadMenuItem ImageUrl="../images/1.jpg" Selected="false">
                                    <GroupSettings ExpandDirection="Down" OffsetX="20" OffsetY="-20" />
                                    <Items>
                                      <telerik:RadMenuItem Text="Add" Value="Add">
                                      </telerik:RadMenuItem>
                                      <telerik:RadMenuItem Text="Edit" Value="EditI">
                                      </telerik:RadMenuItem>
                                      <telerik:RadMenuItem Text="Delete" Value="Delete">
                                      </telerik:RadMenuItem>
                                   </Items>
                                  </telerik:RadMenuItem>
                                </Items>
                              </telerik:RadMenu>
                            </ItemTemplate>
                          </telerik:GridTemplateColumn>


    can anyone help me ?

    Thanks,
  2. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 01 Aug 2013 Link to this post

    Hi,

    Please try the below javascript implementation

    function onClientItemClicked(sender, eventArgs) {
                    var menu = $find("<%= RadMenuClient.ClientID %>");
                    menu.close();
                }


    Thanks,
    A2H
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kiresh
    Kiresh avatar
    24 posts
    Member since:
    Sep 2012

    Posted 02 Aug 2013 Link to this post

    Hi

    i have already try this but it gives me error that cotrolname RadMenuClient could not found.

    any other way ?
    thanks,
  5. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 02 Aug 2013 Link to this post

    Hello,

    Please try the below javascript
    function onClientItemClicked(sender, eventArgs) {
                   sender.close(true);
               }


    Thanks,
    A2H
  6. Kiresh
    Kiresh avatar
    24 posts
    Member since:
    Sep 2012

    Posted 02 Aug 2013 Link to this post

    Hi,

    when i click on item it disappears but when again mouse over that RadMenu it reopen there with selected Item, i need it open only when i click on RadMenu .

    Thanks,
  7. Answer
    A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 02 Aug 2013 Link to this post

    Hello,

    I guess you want to achieve the following functionality

    1) when you click on a Menu item , Menu should close.
    2) On Mouse over RadMenu should not get open and it should happen only when you click on the Rad Menu.
    if that is the case Please try the below javascript implementation


    1) To Close the Menu on selecting item( same code which I provide in previous post)
    function onClientItemClicked(sender, eventArgs) {
                    sender.close(true);
                }
    2) To open Rad Menu only on "Click" event
    a)  Set the "ClickToOpen" property of Rad Menu to true
    ClickToOpen="true"
    b
    ) Hook the  OnClientMouseOver="OnClientMouseOverHandler" on radmenu and use the below javascript
    function OnClientMouseOverHandler(sender, eventArgs) {
                   if (eventArgs.get_item().get_parent() == sender) {
                       sender.set_clicked(false);
                   }
               }


    Thanks,
    A2H

  8. Kiresh
    Kiresh avatar
    24 posts
    Member since:
    Sep 2012

    Posted 02 Aug 2013 Link to this post

    Hi,

    yes u guess exactly what i need and i have already done first 2 steps

    thanks for last step it works fine.


    Thanks
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017