Canceling Edit on TreeView

3 posts, 0 answers
  1. Fakhru
    Fakhru avatar
    37 posts
    Member since:
    Oct 2007

    Posted 26 Jul 2009 Link to this post

    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. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 27 Jul 2009 Link to this post

    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.
  3. Fakhru
    Fakhru avatar
    37 posts
    Member since:
    Oct 2007

    Posted 27 Jul 2009 Link to this post

    Thx, that was I'm looking for.
Back to Top