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

Canceling Edit on TreeView

2 Answers 39 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Fakhru
Top achievements
Rank 2
Fakhru asked on 27 Jul 2009, 12:46 AM
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

Sort by
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();
                }
            }
....
        }

I hope that this answers your question.


Sincerely yours,
Boryana
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.
0
Fakhru
Top achievements
Rank 2
answered on 27 Jul 2009, 02:55 PM
Thx, that was I'm looking for.
Tags
TreeView
Asked by
Fakhru
Top achievements
Rank 2
Answers by
Bobi
Telerik team
Fakhru
Top achievements
Rank 2
Share this question
or