Postback access to updated node text

5 posts, 0 answers
  1. skysailor
    skysailor avatar
    113 posts
    Member since:
    Jul 2007

    Posted 03 Nov 2008 Link to this post

    Hi,
    I am populating the nodes of a treeview control during the initla page load. I have set AllowNodeEditing="True". When a button on the page is clicked and the page is posted back  I step through the nodes in the treeview control. I expect that the Text property of each node will be updated with the value typed in by the user. This does not seem to be the case. How do I get the data posted back to be updated with the user input?
    Clayton.
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 03 Nov 2008 Link to this post

    Hi skysailor,

    You need to subscribe to the NodeEdit server event.

    All the best,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. skysailor
    skysailor avatar
    113 posts
    Member since:
    Jul 2007

    Posted 04 Nov 2008 Link to this post

    Hi,
    what I would like to do is allow multiple nodes in the TreeView to be updated without any postbacks (including adding and deleting and editing the text of nodes). And then the user clicks on a Save button and in that single post back I would like to apply all the changes to my database in one hit. Can this be done with this control?
    Clayton.
  4. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 07 Nov 2008 Link to this post

    Hello skysailor,

    Please check this help article on the matter:
    Accessing client changes on the server side

    I have prepared a small project for you. Please download it and give it a try.

    All the best,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. skysailor
    skysailor avatar
    113 posts
    Member since:
    Jul 2007

    Posted 09 Nov 2008 Link to this post

    Hi Veselin,
    Thanks for the code sample. After working through how to do this (and other client side updates) I would suggest two things.

    Firstly, when you call the TrackChanges/CommitChanges functions you can not only access the changes via the ClientChanges property but ALSO via the actual Nodes property of the TreeView. This is not noted in the documentation and is actually very handy. You can go through the node hierarchy (which may have been changed client side) and apply all changes from that to your DB. I only found this out through experimentation.

    Secondly, it would be much easier if you just had a property that you could set to True to cause client side changes to be tracked. Then you wouldn't need to write any javascript. It would also be good if you automatically supported drag/drop of nodes to rearrange the node tree so you didn't need to write the code for that.

    Clayton.
Back to Top