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

AllowDrop and AllowDrag not part of RadTreeNodeData

9 Answers 82 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jacky Chau
Top achievements
Rank 1
Jacky Chau asked on 19 Aug 2008, 03:51 PM
Is there a way to set AllowDrop and AllowDrag for load on demand nodes?  I dont see those two properties in RadTreeNodeData.

9 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 22 Aug 2008, 12:59 PM
Hello Jacky Chau,

I suggest that you set custom attributes (e.g. "allowDrop" and "allowDrag") when you create the child nodes and then subscribe to the OnClientNodePopulated client-side event, iterate through the child nodes get the attributes and set their AllowDrop and AllowDrag properties using the methods: set_allowDrop and set_allowDrag

I hope this will get you started.

Regards,
Veskoni
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
macy
Top achievements
Rank 1
answered on 07 Nov 2011, 01:22 PM
Hi
I work with thees methodes. But after a Postback on the page the settings are reseted.
It meens i set allowDarg to false and after a PostBack the nodes can draged.

Whats Wrong?
Regards Markus
0
Plamen
Telerik team
answered on 10 Nov 2011, 09:49 AM
Hi Macy,

It is expected if you don't use special custom attributes fields as suggested in the previous post for these properties since they won't be stored and persisted anywhere.

Hope this will be helpful.

All the best,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
macy
Top achievements
Rank 1
answered on 14 Nov 2011, 11:34 AM
Hi
But how should i work with AllowDrop and AllowDrag if i use a web-service to get the sub-Elements? Because RadTreeNodeData do not have a property for AllowDrop And AllowDrag
Regards
Markus
0
Plamen
Telerik team
answered on 16 Nov 2011, 05:13 PM
Hello Macy,

Here is the code that follows the suggestion of Veselin:
foreach (DataRow row in productCategories.Rows)
        {
            RadTreeNodeData itemData = new RadTreeNodeData();
                                                            itemData.Attributes.Add("a", (object)"a");

function OnClientNodePopulated(sender, args) {
 
          alert(args.get_node().get_nodes().getItem(3).get_attributes().getAttribute("a"));
          args.get_node().get_nodes().getItem(3).set_allowDrop(true);
      }

Hope this will be helpful.

Best wishes,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
macy
Top achievements
Rank 1
answered on 12 Dec 2011, 01:05 PM
Hi

This solution is already known to me. But how to get to a stable closure of drag and drop individual elements if they are after a postback attributes gone. So after a postback all nodes that have been locked in the Web service will be active.

Thus it is not really a solution, can work with.

Why the class "RadTreeNodeData" has no Attributte "AllowDrag" and "AllowDrop" as RadTreeNode? they are stable and survive a postback.

Regards
Markus

0
Plamen
Telerik team
answered on 15 Dec 2011, 03:11 PM
Hello Macy,

Have you considered handling the client load event of the tree? The attributes persist so we can use their value to set each node's drag or drop properties after the postback as in the code:

function OnClientLoad(sender, args) {
            var tree = $find("<%=RadTreeView3.ClientID%>");
            var allNodes = tree.get_allNodes();
            for (var index in allNodes) {
 
                if (allNodes[index].get_attributes().getAttribute("a")) {
                    alert(allNodes[index].get_allowDrop());
                    allNodes[index].set_allowDrop(false);
                    alert(allNodes[index].get_text());
                    alert(allNodes[index].get_allowDrop());
                }
            }
        }

Hope this will be helpful.

Thank you for  your feature request. We will consider implementing AllowDrag and AllowDrop properties to the RadTreeNodeData.

Regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
mohmedsadiq modan
Top achievements
Rank 1
answered on 19 Dec 2011, 01:40 PM
Hello,

I have a same issue, do you have solution for this issue, how can we maintain node state after postaback.

Please provide better solution.

Thanks in Advance.
Mohmedsadiq
0
macy
Top achievements
Rank 1
answered on 19 Dec 2011, 08:07 PM
Hi
with the OnLoadEvent, it works. But you have to be shure, that you use booleans in the set_allowDrag

Regards Markus
Tags
TreeView
Asked by
Jacky Chau
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
macy
Top achievements
Rank 1
Plamen
Telerik team
mohmedsadiq modan
Top achievements
Rank 1
Share this question
or