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

RadTreeView PostBack Problem: User check some Nodes but on server nothing is checked

2 Answers 265 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gregor Daskaloff
Top achievements
Rank 1
Gregor Daskaloff asked on 31 Mar 2010, 03:07 PM
Hi,

I have the following problem: I have a form with a RadTreeView:


<telerik:RadTreeView ID="dataTree" runat="server" CheckBoxes="True" TriStateCheckBoxes="True" Width="100%" MultipleSelect="True" Height="300px"
</telerik:RadTreeView> 
 
... and CS source 
 
foreach (RadTreeNode node in this.dataTree.CheckedNodes) // Count = 0 after Postback! 
  ... 

The TreeView includes checkboxes for each node.
When the user selects a node and triggers a postback button, then on the server "CheckedNodes" property of the TreeView is empty (Count = 0).

Although ViewState is enabled globally and for the control is, the ViewState for the TreeView is not saved. For all other controls, however, it is saved.

What could be cause this problem? ViewState is enabled globally and there are no other scripts that affect the behavior.

My form is also identical with this ASP.NET example: http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/checkboxes/defaultcs.aspx
(Except for the Ajax Manager)

Thanks in advance.
Greeting
Gregor Daskaloff

2 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 02 Apr 2010, 09:53 AM
Hi Gregor Daskaloff,

You attached a screenshot where all the nodes are unchecked. Are you sure you checked at least one node before the postback?

Best wishes,
Veskoni
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Accepted
Gregor Daskaloff
Top achievements
Rank 1
answered on 02 Apr 2010, 11:07 AM
Hi,

ok I have now found the error. I had forgotten to put "!IsPostBack" in the Page_Load event for the TreeView.

Now everything works.
Tags
TreeView
Asked by
Gregor Daskaloff
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Gregor Daskaloff
Top achievements
Rank 1
Share this question
or