Hi
I have a treeview with drag and drop enabled. I'm constructing the treeview programatically.
I want to update the nodes (server side) when I drop into new position.
Can I use an AJAXRadPanel with serverside code to stop full postback?
Also can I keep the dropped node selected once a postback has occured?
If so does anybody have any samples?
Many Thanks
I have a treeview with drag and drop enabled. I'm constructing the treeview programatically.
I want to update the nodes (server side) when I drop into new position.
Can I use an AJAXRadPanel with serverside code to stop full postback?
Also can I keep the dropped node selected once a postback has occured?
If so does anybody have any samples?
Many Thanks
5 Answers, 1 is accepted
0
Hi there,
Using RadAjaxPanel to stop full postback is the best solution in your case. I've attached a simple page demonstrating this approach, also the dropped node is selected. Please download it and give it a try.
Greetings,
Yana
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Using RadAjaxPanel to stop full postback is the best solution in your case. I've attached a simple page demonstrating this approach, also the dropped node is selected. Please download it and give it a try.
Greetings,
Yana
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Cos
Top achievements
Rank 1
answered on 24 Mar 2009, 04:21 PM
Thanks for your reply. I had a few issues with incorporating your postback solution and I didn't elaborate enough on my issue yesterday...
My treeview has attributes associated with each node that stores the order number. For example;
Node | Order
1 1
2 2
3 3
4 4
5 5
Moving Node 4 above Node 2 means it would look like (in database)
Node | Order
1 1
2 3
3 4
4 2
5 5
On postback using your example the new attribute are not coming back through. The nodes are retaining their position but hold the incorrect attribute value. I am using RadTreeView_NodeDataBound to add attribute values.
Is this still possible - I also want to incorporate load on demand to this scenario at some point - will this be possible?
My treeview has attributes associated with each node that stores the order number. For example;
Node | Order
1 1
2 2
3 3
4 4
5 5
Moving Node 4 above Node 2 means it would look like (in database)
Node | Order
1 1
2 3
3 4
4 2
5 5
On postback using your example the new attribute are not coming back through. The nodes are retaining their position but hold the incorrect attribute value. I am using RadTreeView_NodeDataBound to add attribute values.
Is this still possible - I also want to incorporate load on demand to this scenario at some point - will this be possible?
0
Hello,
You should manually set Order attribute to all nodes according to their new order. I've modified the project to show you how you can do that.
Best wishes,
Yana
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
You should manually set Order attribute to all nodes according to their new order. I've modified the project to show you how you can do that.
Best wishes,
Yana
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Cos
Top achievements
Rank 1
answered on 06 Apr 2009, 10:33 PM
Thanks for the reply, this does work but only when the button postsback.
In my scenario the order is not updating. I am using the attribute value to pass through to a stored proc which updates order in table.
As an example to demonstrate my result, if I add a tooltip for each node in the RadTreeView_NodeDataBound from the example you gave me, the attribute value doesn't update.
How can I update the value?
Many thanks in advance.
In my scenario the order is not updating. I am using the attribute value to pass through to a stored proc which updates order in table.
As an example to demonstrate my result, if I add a tooltip for each node in the RadTreeView_NodeDataBound from the example you gave me, the attribute value doesn't update.
e.Node.ToolTip = (e.Node.DataItem as DataRowView)["Order"].ToString(); |
How can I update the value?
Many thanks in advance.
0
Hi there,
The Tooltip value should be updated when the value of "Order" is updated - in PerformDragAndDrop method like this:
Kind regards,
Yana
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
The Tooltip value should be updated when the value of "Order" is updated - in PerformDragAndDrop method like this:
... |
case RadTreeViewDropPosition.Above: |
// sibling - above |
destNode.InsertBefore(sourceNode); |
for (int i = 0; i < destNode.TreeView.Nodes.Count; i++) |
{ |
destNode.TreeView.Nodes[i].Attributes["Order"] = (i + 1).ToString(); |
destNode.TreeView.Nodes[i].ToolTip = destNode.TreeView.Nodes[i].Attributes["Order"]; |
} |
break; |
case RadTreeViewDropPosition.Below: |
// sibling - below |
destNode.InsertAfter(sourceNode); |
for (int j = 0; j < destNode.TreeView.Nodes.Count; j++) |
{ |
destNode.TreeView.Nodes[j].Attributes["Order"] = (j + 1).ToString(); |
destNode.TreeView.Nodes[j].ToolTip = destNode.TreeView.Nodes[j].Attributes["Order"]; |
} |
break; |
... |
Kind regards,
Yana
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.