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

Refresh RadTreeView via RadAjaxManager causes loss of functionality

2 Answers 148 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Courtney Weatherton
Top achievements
Rank 1
Courtney Weatherton asked on 10 Dec 2010, 10:59 PM
Hello,

I have a control that loads a RadTreeView using an object as the source and performing on-demand loading of child nodes via the OnNodeExpand event.  I also use a RadWindow to allow users to edit the tree nodes.  When the user saves their changes on the RadWindow, it fires an ajax event using javascript which then uses an ajax request to update the node in the tree.  This is working very nicely. 

However, when the user finishes editing and closes the RadWindow the RadTree no longer functions properly.  The OnNodeExpand event is no longer firing when trying to expand a node and the OnClientMouseOver I was using to display tooltips is not effective below the first level of nodes.  I've tried adding the NodeExpand event handler back in after the update just in case it's getting lost somewhere, but this doesn't seem to work.

Any ideas what I'm doing wrong?

Thanks,
Courtney

Here's my ajax request code
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    string[] values = e.Argument.Split(new[] { "|" }, 2, StringSplitOptions.None);
    string nodeId = values[0];
    string nodeText = values[1];
    foreach (RadTreeNode node in GroupTree.Nodes)
    {
        if (UpdateNode(node, nodeId, nodeText))
            break;
    }
    GroupTree.NodeExpand += (GroupTreeOnNodeExpand);
}
private static bool UpdateNode(RadTreeNode node, string nodeId, string nodeText)
{
    if (node.Attributes["id"] == nodeId)
    {
        node.Text = nodeText;
        return true;
    }
    foreach (RadTreeNode childNode in node.Nodes)
    {
        if (UpdateNode(childNode, nodeId, nodeText))
            return true;
    }
    return false;
}

 

 

2 Answers, 1 is accepted

Sort by
0
Courtney Weatherton
Top achievements
Rank 1
answered on 13 Dec 2010, 11:44 PM
Any ideas?  Should I post this thread in the TreeView forum instead?  Or submit a support ticket?
0
Maria Ilieva
Telerik team
answered on 15 Dec 2010, 12:04 PM
Hi Courtney,

Could you please elaborate a bit more on your application? What are the exact Ajax settings you have? In this scenario I suggest you to set the AjaxManager control to update the RadWindow and the RadTreeView control also have setting in which the RadWindow updates the RadTreeView control.


All the best,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Ajax
Asked by
Courtney Weatherton
Top achievements
Rank 1
Answers by
Courtney Weatherton
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or