Confirmation Message

5 posts, 0 answers
  1. Manoj
    Manoj avatar
    75 posts
    Member since:
    Dec 2008

    Posted 03 Mar 2009 Link to this post

    Hi Team,
        I am using a tree view . When user will right click on any of the node he can able to add a child node . But fore that I want to display a confirmation message . If he/she confirms then only he can able to add a new child node . For this I have written the bellow mentioned code . It is working for when user is confirms but it not working when user not confirming it . It is giving error at
    "args.set_cancel(true);" . Can you please help me out .

     

     

    function

    onClientContextMenuItemClicked(sender, args)

     

    {

     

    var menuItem = args.get_menuItem();

     

     

    var treeNode = args.get_node();

     

     

    if (!confirm("Do you really want to add a new value. ? "))

     

    {

    args.set_cancel(

    true);

     

    }

     

    else

     

    {

     

    switch(menuItem.get_value())

     

    {

     

    case "NewValue":

     

     

    break;

     

    }

    }

    }


    With Regards
    Manoj

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 03 Mar 2009 Link to this post

    Hi Manoj,

    Attach the function to OnClientContextMenuItemClicking  event of RadTreeView instead of OnClientContextMenuItemClicked. The OnClientContextMenuItemClicking client-side event occurs when the user clicks a menu item, but before the OnClientContextMenuItemClicked event fires, and performing any action for contextmenuitem click and can be canceled.

    Thanks,
    Princy.
  3. Manoj
    Manoj avatar
    75 posts
    Member since:
    Dec 2008

    Posted 04 Mar 2009 Link to this post

     
  4. Manoj
    Manoj avatar
    75 posts
    Member since:
    Dec 2008

    Posted 04 Mar 2009 Link to this post

    Hi Princy,
        Thanks for your reply . I used the OnClientContextMenuItemClicking event earier , but issue was when you don't confirm the message still the context menu item was displaying , if you clicked outside once then only the context menu item is removing . Can you suggest me what should I do in this case .

    Regards
    Manoj
  5. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 04 Mar 2009 Link to this post

    Hi Manoj,

    Canceling the OnClientContextMenuItemClicking means that the click on the menu item is canceled. It does not mean the menu would close. You can close it by yourself (using the hide() or close() javascript methods).

    I hope this helps.

    Kind regards,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top