Delete Confirmation from RadTreeView ContextMenu event

5 posts, 0 answers
  1. Connor
    Connor avatar
    3 posts
    Member since:
    Jan 2009

    Posted 06 Jan 2009 Link to this post

    Hi,

    For our RadTreeView we have an "Delete" option in the context menu, for a given node. Upon clicking on this, we want a confirmation to appear i.e. "Are you sure you want to delete this node? Ok/Cancel". If the user selects OK, the data associated with this node will be deleted from the database, and the TreeView will be databinded again. However, if the user selects "Cancel", we don't want a post-back to occur. We have implemented the confirmation with a client side javascript function attached to the OnClientContextMenuItemClicked event, which then calls confirm() etc. How can we then get the TreeView to databind again?

    Thanks
    -Connor
  2. Enrico Foschi
    Enrico Foschi avatar
    12 posts
    Member since:
    Dec 2008

    Posted 07 Jan 2009 Link to this post

    Hi guys, this issue is blocking us as well and has a pretty high importance.

    Is there a way to block the postback if, afterclicking on , let's say, a "delete" option from the context menu, the user cancel the operation through a window.confirm?

    Process:
    1. User right click on a node
    2. The context menu appears
    3. The user choose the option "Delete"
    4. A client event ask for a confirmation to the user (window.confirm)
    5. The user approves, the node is deleted (through an AJAX call via Javascript to a Webservice) and the treeview is re-data-binded (re-collapsing unfortunately all the nodes)
    --> fine till here
    6. The user cancel the operation, nothing happens
    --> we don't know how to avoid the postback or send an extra variable to the back-end to tell it to bypass the useless refresh

    Any help?

    Thanks,
    Enrico
  3. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 07 Jan 2009 Link to this post

    Hi Enrico Foschi,

    Find attached an example which demonstrates how to cancel the postback.

    All the best,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. Enrico Foschi
    Enrico Foschi avatar
    12 posts
    Member since:
    Dec 2008

    Posted 07 Jan 2009 Link to this post

    Albert,

    that is much appreciated,

    Many thanks,

    Enrico Foschi
  5. Connor
    Connor avatar
    3 posts
    Member since:
    Jan 2009

    Posted 07 Jan 2009 Link to this post

    Hi Albert,

    Thanks very much, managed to get it working now, much appreciated.

    -Connor
Back to Top