Calling RadWindow from ContextMenu

5 posts, 1 answers
  1. Harald Breidler
    Harald Breidler avatar
    7 posts
    Member since:
    Aug 2004

    Posted 13 Apr 2010 Link to this post

    I use the ContextMenu in RadTreeView for add/edit/delete nodes. On inserting and editing nodes, I need some user input, in order to do some other work. Therefore I want to open a RadWindow on clicking a contextmenuitem with value of selected node as parameter.

    Could you please suggest me how to handle this scenario.

    Thanks in advance,
    Harald Breidler
  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Apr 2010 Link to this post

    Hello Harald Breidler,

    Attach 'OnClientContextMenuItemClicked' event to RadTreeView and in the handler, get the item clicked using 'get_menuItem()' method. Then open the window by using any of the methods described in the following documenation.

    Opening Windows


  3. Harald Breidler
    Harald Breidler avatar
    7 posts
    Member since:
    Aug 2004

    Posted 20 Apr 2010 Link to this post

    Hi Shinu,

    that was the solution!

    Thank you very much,
  4. Sonia
    Sonia avatar
    90 posts
    Member since:
    Mar 2012

    Posted 08 Oct 2013 Link to this post

    Hi Shinu,

    i am trying to implement OnClientContextMenuItemClicked event to RadTreeView in order to open rad window. 
    The RadWindow appears and after some milliseconds it disappears. It seems it is doing a postback, how can i cancel the postback when clicking only on specific menu items?

    Thank you.

    function onClientContextMenuItemClicked(sender, args) {
                var menuItem = args.get_menuItem();
                var treeNode = args.get_node();
                switch (menuItem.get_value()) {
                    case "NewFolder":
                            $find("<%=RadWindow_AddFolder.ClientID %>").show();

    <telerik:RadTreeView ID="RadTreeView1" runat="server" OnClientDoubleClick="OnClientDoubleClick"
    OnClientContextMenuItemClicking="onClientContextMenuItemClicking" OnClientContextMenuShowing="onClientContextMenuShowing"
    OnNodeExpand="RadTreeView1_NodeExpand" LoadingStatusPosition="BelowNodeText" LoadingMessage=" Loading..."
    OnNodeClick="RadTreeView1_NodeClick" >               
                    <telerik:RadTreeViewContextMenu ID="MyContextMenu" runat="server">
                            <telerik:RadMenuItem Value="Edit" Text="Edit ..." ImageUrl="~/img/pencil.png">
                            <telerik:RadMenuItem Value="Delete" Text="Delete ..." ImageUrl="~/img/delete.png">
                            <telerik:RadMenuItem IsSeparator="true">
                            <telerik:RadMenuItem Value="NewFolder" Text="New folder" ImageUrl="~/img/new.png">
                        <CollapseAnimation Type="none"></CollapseAnimation>

  5. Kate
    Kate avatar
    1898 posts

    Posted 09 Oct 2013 Link to this post

    Hi Sonia,

    Try using the OnClientContextMenuItemClicking client side event that enables you cancel the postback. To achieve that you can use the following javascript code:
      function OnClientContextMenuItemClicking(sender, args) {
    //in this function you can also add your current logic

    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 the blog feed now.
Back to Top