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

Client side index changes disappearing on postback

2 Answers 94 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Michael Abrahamsen
Top achievements
Rank 1
Michael Abrahamsen asked on 01 Apr 2008, 06:02 PM
Hi,
I'm using the client side drag and drop functionality of the TreeView to reorder a simple list. Here is my javascript that handles the event.

 function OnClientNodeDroppingHandler(sender, eventArgs)
 {  
     var treeView = sender;
     treeView.trackChanges();
     var node = eventArgs.get_sourceNode();
     var targetIndex = treeView.get_nodes().indexOf(eventArgs.get_destNode());
     treeView.get_nodes().remove(node)
     treeView.get_nodes().insert(targetIndex, node);
     treeView.commitChanges();
     eventArgs.set_cancel(true);
 }

This seems to work fine on the client side, but when I post back, the nodes are still in their original order.

i've also tried changing the first line to:
 var treeView = $find("<%= RadTreeView1.ClientID %>");

Help appreciated.

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 02 Apr 2008, 06:48 AM
Hi Michael Abrahamsen,

Can you put together a small example and send the files to us attaching them to a new support thread? I tried your approach at our side, but I got other JS errors. Therefore, I believe that it would be best if you send a running project showing the matter.

Thanks for your time.

Expecting your reply,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael Abrahamsen
Top achievements
Rank 1
answered on 02 Apr 2008, 12:32 PM
Hi Nick,
Yes, I could put together a little example project for you or I could just admit that it was my own stupid mistake and I figured it out. I think I'll opt for the latter.

Thanks for your help.
Tags
TreeView
Asked by
Michael Abrahamsen
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Michael Abrahamsen
Top achievements
Rank 1
Share this question
or