Set in editing mode from code-behind

5 posts, 0 answers
  1. sdupere
    sdupere avatar
    1 posts
    Member since:
    Dec 2009

    Posted 28 Dec 2009 Link to this post

    Hello,

    I'm looking for a way to put the treelistview control in editing mode from code-behind. More precisely, I need the selected line to be set to editable when the user clicks on a 'Modify' button on the form.

    I know pressing F2 seems to set the editable mode on with the TreeView, but it doesn't work yet on the TreeListView?

    Thank you

    -Simon
  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 29 Dec 2009 Link to this post

    Hello Simon,

    Thank you for your interest in the TreeListView! Please note that the control is a CTP, so it may change in future versions.

    This should put the currently selected item in edit mode:

    if(treeList.SelectedContainer != null)
    {
        treeList.SelectedContainer.BeginEdit();
    }

    To get the editing working, you need to set the IsEditable property on the TreeList and the same property on the column you want to be editable. In this version you need to specify a CellEditTemplate for the column explicitly.

    Hopefully this will work for you,

    Greetings,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. VH
    VH avatar
    27 posts
    Member since:
    Mar 2010

    Posted 08 Mar 2010 Link to this post

    Sorry, solved. my bad...
  5. Ketaki
    Ketaki avatar
    26 posts
    Member since:
    Apr 2009

    Posted 07 Apr 2010 Link to this post

    Hi,

    I am using tree control RadTreeListView, where isEditable is set to true in XAML file.

    I want to enable/disable the property "isEditable" depending upon certain conditions.

    for e.g. if the DTO object binded with tree contains "allow"(proeprty in DTO object) proeprty to "true", make "isEditable" to true otherwise dont allow user to edit the column/value.

    Right now I am trying to set isEditable to false in code behind, but its not taking effect and always allows user to edit.

    Is this possible? If yes, how to do it?

    Help needed asap.

    Thanks
    Ketaki
  6. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 08 Apr 2010 Link to this post

    Hi Ketaki,

    There is an IsEditable property on the TreeListViewItem. You can use container bindings to bind it to a property on your ViewModel and turn off/on editing for a particular row.

    If you need fine-grained editing you can handle the PreviewEditStarted routed event of the item. Marking this event as handled (e.Handled = true) means that the editing will not start.

    Please note that the TreeListView is a CTP and some major changes are expected for its next version as it will be based on the GridView rather than the TreeView. It is best no to base any production code on it yet.

    Best wishes,
    Miroslav
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
DevCraft banner