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

[Solved] Null value posted when TreeViewItem is not checked explicitly

1 Answer 31 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Raman
Top achievements
Rank 1
Raman asked on 03 Oct 2011, 02:13 PM
Hi

I implemented the TreeView - Checkbox according to the example given in the demo. It works ok.

Then I added support for Client Side event for OnChecked() which does the following: When a parent is checked/unchecked, check/uncheck all of its child nodes. If a node is unchecked, uncheck all its parents up in the hierarchy till the root.

Consider this hierarchy A -- B -- C where A is the root parent. B is the child of A and C is the child of B. Now if I check the root A, both B and C are checked automatically. All the checked nodes i.e. A, B, and C, in our case, are posted to the server. So far so good.

But when I look at the Value property of the A, B, and C nodes, the A TreeViewItem holds the valid Value as expected. But the Value of the B and C are null. Why is it so, am I doing anything wrong?

It looks like I have not checked the B and C nodes explicitly and therefore the null is passed. If this is the case, can we assume that there is a bug in the TreeViewItem? If yes, is there a workaround.

An early reply would be greatly appreciated.

1 Answer, 1 is accepted

Sort by
0
Latisha
Top achievements
Rank 1
answered on 01 Dec 2011, 05:21 PM
I have the same issue
Tags
TreeView
Asked by
Raman
Top achievements
Rank 1
Answers by
Latisha
Top achievements
Rank 1
Share this question
or