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

CheckNodes is always empty after postback

1 Answer 91 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 26 Jul 2008, 09:31 PM
After populating a tree control using an on-demand method and clicking a submit button, the Nodes and CheckedNodes collections are empty.  I am not re-populating the tree control in Page_Load if it is a postback.  A similar post mentioned putting the tree control setup in Page_Init, but I'm assuming the control doesn't yet exist in Page_Init because no data appears when I use this approach.

Basically, in Page_Load() I have some code that reads:

if (IsPostBack)
{
    System.Collections.Generic.IList<RadTreeNode> nodes = TreeView1.CheckedNodes;
    foreach (RadTreeNode node in nodes)
        ...
}

The CheckedNodes collection is always empty.  What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 28 Jul 2008, 03:22 PM
Hi Kevin,

I tried to reproduce the described behavior but everything worked normally. Generally, Nodes added via Load-On-Demand are persisted on the server and they are available later after postback.

Can you provide more information about your TreeView definition and any code that might be interfering with the control's behavior?

Best wishes,
Simon
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Kevin
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or