Hello,
I am currently using a RadTreeView that loads its child nodes on demand.
When a node is dragged and dropped (using server side code) onto a child node (that was loaded on demand), an Ajax postback occurs and the expanded child nodes, including the dropped node display with no text. The structure and icons appear correctly but the node text no longer displays.
If an additional postback occurs (through another drag and drop or some other action), the text re-appears.
Please advise.
Very Respectfully,
Liz
I am currently using a RadTreeView that loads its child nodes on demand.
When a node is dragged and dropped (using server side code) onto a child node (that was loaded on demand), an Ajax postback occurs and the expanded child nodes, including the dropped node display with no text. The structure and icons appear correctly but the node text no longer displays.
If an additional postback occurs (through another drag and drop or some other action), the text re-appears.
Please advise.
Very Respectfully,
Liz
4 Answers, 1 is accepted
0
Hello Liz,
In case of using node templates for customizing your RadTreeView control, I would suggest data-binding both destination and source node in your NodeDrop server-side event handler.
If you are adding your templates at run-time, please instantiate your template and apply it to both nodes in that same event handler.
If you are still facing that issue, please elaborate a bit more on your scenario or open a support ticket in order to sends us a runnable project for further investigation.
Kind regards,
Boyan Dimitrov
the Telerik team
In case of using node templates for customizing your RadTreeView control, I would suggest data-binding both destination and source node in your NodeDrop server-side event handler.
If you are adding your templates at run-time, please instantiate your template and apply it to both nodes in that same event handler.
If you are still facing that issue, please elaborate a bit more on your scenario or open a support ticket in order to sends us a runnable project for further investigation.
Kind regards,
Boyan Dimitrov
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
Liz
Top achievements
Rank 1
answered on 15 Apr 2013, 07:51 PM
Hi Boyan,
I am just coming back to this problem now. Sorry for the delay.
Is there any chance you could post an example of what you mean for data-binding the nodes? I have the tree data-bound, but I am not certain what you mean when you say to data-bind a single node.
Very Respectfully,
Liz
I am just coming back to this problem now. Sorry for the delay.
Is there any chance you could post an example of what you mean for data-binding the nodes? I have the tree data-bound, but I am not certain what you mean when you say to data-bind a single node.
Very Respectfully,
Liz
0
Hello Liz,
Thank you for getting back to us.
The code snippet below illustrates how you can data bind the source node and your destination node in your NodeDrop server-side event:
//markup code
//code behind
If this is not solving your issue, could you please clarify the following;
Hope that this will be helpful.
All the best,
Boyan Dimitrov
the Telerik team
Thank you for getting back to us.
The code snippet below illustrates how you can data bind the source node and your destination node in your NodeDrop server-side event:
//markup code
<
telerik:RadTreeView
ID
=
"RadTreeView1"
runat
=
"server"
OnNodeExpand
=
"RadTreeView1_NodeExpand"
EnableDragAndDrop
=
"true"
EnableDragAndDropBetweenNodes
=
"true"
OnNodeDrop
=
"RadTreeView1_NodeDrop"
>
.....
</
telerik:RadTreeView
>
protected
void
RadTreeView1_NodeDrop(
object
sender, RadTreeNodeDragDropEventArgs e)
{
e.DestDragNode.Nodes.Add(e.SourceDragNode);
e.DestDragNode.Expanded =
true
;
e.DestDragNode.DataBind();
e.SourceDragNode.DataBind();
}
If this is not solving your issue, could you please clarify the following;
- How do you load your nodes?
- How do you apply your templates?
- How do you add the source node to the destination node in the code behind?
Hope that this will be helpful.
All the best,
Boyan Dimitrov
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
Liz
Top achievements
Rank 1
answered on 01 May 2013, 08:13 PM
Fixed the problem.
I had to loop back over the nodes in PostBack and re-apply the NodeTemplate. On its own, this caused node data to be wonky (node value mismatched with positions), but after applying DataBinding as well, the issue was resolved.
I'm not sure it's the best way to do it, but I've included an example of what worked for me below:
I had to loop back over the nodes in PostBack and re-apply the NodeTemplate. On its own, this caused node data to be wonky (node value mismatched with positions), but after applying DataBinding as well, the issue was resolved.
I'm not sure it's the best way to do it, but I've included an example of what worked for me below:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(Page.IsPostBack)
{
CustomTemplate radTreeTemplate = _radTree.NodeTemplate ==
null
?
new
CustomTemplate() : _radTree.NodeTemplate
as
CustomTemplate;
IList<RadTreeNode> treeNodes = _radTree.GetAllNodes();
foreach
(RadTreeNode node
in
treeNodes)
{
radTreeTemplate.InstantiateIn(node);
node.DataBind();
}
....
}
...
}