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

TreeView NodeClick and AjaxPanel

2 Answers 85 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Neel
Top achievements
Rank 1
Neel asked on 28 Oct 2011, 07:41 AM
I spent a few hours ripping my hair out over this one - but it appears that there is a bug in the NodeCheck event in RadTreeView. It may be specific to Firefox/Mozilla, and i've tried the no-cache fix, with no luck.

As an example, create a TreeView with checkboxes=true, and populate it with say 10 nodes in the Page_Load event. Add a NodeCheck server side event (the function can be empty).  Wrap the TreeView in an AjaxPanel, and run the project.

<telerik:RadAjaxPanel ID="rap2" runat="server">
<telerik:RadTreeView runat="server" ID="tv1" CheckBoxes="true"  onnodeexpand="tv1_NodeExpand" onnodecheck="tv1_NodeCheck"  >
</telerik:RadTreeView>
</telerik:RadAjaxPanel>

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        tv1.Nodes.Clear();
        for (int i = 0; i < 10; i++)
        {
            tv1.Nodes.Add(new RadTreeNode(i.ToString()));
        }
    }
}

Check off all the boxes, and hit refresh on the browser (CTRL-R or F5). When the page reloads, either none of the nodes will be checked, or only the first node will be checked. It appears that the ViewState is not being saved after a NodeCheck event.

The hack solution i have for the time being is to add in an OnClientNodeChecked handler with the following:
function ClientNodeCheck() {
    var tree = $find("<%= tv1.ClientID %>");
    tree.UpdateState()
}


Could you please confirm if this is in fact a bug, and if there will be a fix for this in an upcoming release?

Thanks,

N.

2 Answers, 1 is accepted

Sort by
0
Neel
Top achievements
Rank 1
answered on 28 Oct 2011, 07:47 AM
Quick update - it seems that my serverside OnClick event is no longer firing after adding in the ClientSide event - is this expected?
0
Princy
Top achievements
Rank 2
answered on 28 Oct 2011, 08:01 AM
Hello Neel,

Check the following code library which explains how to persist checked state of CheckBox in RadTreeView.
Persist Checked State after PostBack.

Thanks,
Princy.
Tags
TreeView
Asked by
Neel
Top achievements
Rank 1
Answers by
Neel
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or