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

Delete Confirmation from RadTreeView ContextMenu event

4 Answers 164 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Connor
Top achievements
Rank 1
Connor asked on 06 Jan 2009, 05:41 PM
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

4 Answers, 1 is accepted

Sort by
0
Enrico Foschi
Top achievements
Rank 2
answered on 07 Jan 2009, 12:33 PM
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
0
Atanas Korchev
Telerik team
answered on 07 Jan 2009, 02:12 PM
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.
0
Enrico Foschi
Top achievements
Rank 2
answered on 07 Jan 2009, 02:49 PM
Albert,

that is much appreciated,

Many thanks,

Enrico Foschi
0
Connor
Top achievements
Rank 1
answered on 07 Jan 2009, 02:55 PM
Hi Albert,

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

-Connor
Tags
TreeView
Asked by
Connor
Top achievements
Rank 1
Answers by
Enrico Foschi
Top achievements
Rank 2
Atanas Korchev
Telerik team
Connor
Top achievements
Rank 1
Share this question
or