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

Postback access to updated node text

4 Answers 48 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
skysailor
Top achievements
Rank 1
skysailor asked on 03 Nov 2008, 06:29 AM
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.

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 03 Nov 2008, 01:07 PM
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.
0
skysailor
Top achievements
Rank 1
answered on 04 Nov 2008, 10:32 PM
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.
0
Veselin Vasilev
Telerik team
answered on 07 Nov 2008, 02:07 PM
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.
0
skysailor
Top achievements
Rank 1
answered on 09 Nov 2008, 10:28 PM
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.
Tags
TreeView
Asked by
skysailor
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
skysailor
Top achievements
Rank 1
Share this question
or