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

Copying nodes from one tree to another

2 Answers 77 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 04 Jun 2009, 08:22 AM
Hi there,

I am writing a component that involves dragging nodes from the one tree to another, as in the drag-and-drop example given in the demos at http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/draganddropnodes/defaultcs.aspx.  I make all the changes on the client and then commit them to the server when the user presses a button, using the client-side tree.trackChanges() and tree.commitChanges() functions.  In my component, only changes to the right-hand tree are kept.  Initially, the two trees are the same, and the right-hand one is my "true" version.

After each postback, I need to synchronise the two trees again.  The trouble is that I can't find the right place in the page life-cycle to do so.  I have tried putting code in the Page_Load() or Page_PreRender() methods, but the trees haven't been updated (with the client-side changes) by that point, so this doesn't work.  Can you advise me?

All answers gratefully received,

Ed

2 Answers, 1 is accepted

Sort by
0
Uday Anthony
Top achievements
Rank 1
answered on 16 Oct 2009, 09:20 PM
Hi Ed,

I have the same problem. Did you find a solution to it? Please let me know. Thanks in advance.
0
Ed
Top achievements
Rank 1
answered on 22 Oct 2009, 01:24 PM
Hi Uday

I'm afraid I didn't; at least, not satisfactorily.  In the end, I had to force a reload like this:

        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (this.IsPostBack) 
            { 
                // update the database with the client-side changes 
                ProcessUpdates(); 
                // *reload page*: this is the only way I can think of that synchronises the left and right trees 
                Response.Redirect("DualEditor.aspx"); 
            } 
        } 

Not great for performance, but it did the job.

Good luck,

Ed
Tags
TreeView
Asked by
Ed
Top achievements
Rank 1
Answers by
Uday Anthony
Top achievements
Rank 1
Ed
Top achievements
Rank 1
Share this question
or