How do I cancel editing on TreeView?
I want to do some check on Database, it criteria doesn't meet it will rollback the old value.
2 Answers, 1 is accepted
0
Bobi
Telerik team
answered on 27 Jul 2009, 12:18 PM
Hi Fakhru,
If you want to cancel the editing of RadtreeViewItem all you have to do is just to handle PreviewEdited event and call CancelEdit() as demonstrated in the following sample code:
private void tree_PreviewEdited(object sender, RadTreeViewItemEditedEventArgs e)
{
//cancel the edit and return the old value
if (e.NewText == "123")
{
e.Handled = true;
RadTreeViewItem item = tree.SelectedContainer;
if (item != null)
{
item.CancelEdit();
}
}
....
}