finding unchecked nodes..

3 posts, 1 answers
  1. Caroline
    Caroline avatar
    21 posts
    Member since:
    May 2009

    Posted 08 Jul 2009 Link to this post

    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. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Jul 2009 Link to this post

    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
  3. Caroline
    Caroline avatar
    21 posts
    Member since:
    May 2009

    Posted 09 Jul 2009 Link to this post

    thanks great Shinu works perfectly thanks so much.
Back to Top