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

finding unchecked nodes..

2 Answers 63 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Caroline
Top achievements
Rank 1
Caroline asked on 08 Jul 2009, 02:30 PM
Hiya

if the following gets my all the checkboxes i have checked, how can i find all the checkboxes that arent checked?  Bascially when you first go to my page i want to preload any selections you may have made before by checking boxes...obviously the below is wrong as i have nocheckednodes at the start but how to i change it to select all nodes???

many thanks

Dim

 

nodeCollection As IList(Of Telerik.Web.UI.RadTreeNode) = RadTreeView1.CheckedNodes

 

 

       For Each node As Telerik.Web.UI.RadTreeNode In nodeCollection

 

 

            If e.Node.Value = objuser.ViewableDivisionID Then

 

                e.Node.Checked =

True

 

 

        End If

 

 

    Next

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 09 Jul 2009, 07:57 AM
Hi Caroline,

I guess the  checkBoxes are not maintaining its state after a postback in your case. If so you may refer the following code library submission which explains how to persist the checked nodes of a RadTreeView after postback.
Persist Checked State after PostBack

Once you are able to persist checked state you can try the following code logic to loop through the unchecked nodes of the treeview and then check it depending on the node value.

VB:
 
 
    For Each node As RadTreeNode In RadTreeView1.Nodes 
        If (Not node.Checked) AndAlso (node.Value = "Node2") Then 
            node.Checked = True 
        End If 
    Next 
 


Thanks
Shinu
0
Caroline
Top achievements
Rank 1
answered on 09 Jul 2009, 08:23 AM
thanks great Shinu works perfectly thanks so much.
Tags
TreeView
Asked by
Caroline
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Caroline
Top achievements
Rank 1
Share this question
or