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

How to get nodes checked on load

1 Answer 40 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 21 Jul 2010, 10:27 PM
I have a treeview and I want certain nodes to be checked when the page loads and some not checked. I want to do this manually before I loop through a database so was wondering if there is any VB.NET code out there that would show me.

I was thinking something like this (using objects):

Dim Cat As List(Of Category)
        Cat = Category.GetAllCategories
        If Not Cat Is Nothing Then

               Dim C As New RadTreeNode
                      Dim CatEach As Category
                           For Each CatEach In Cat
                                 C.Text = CatEach.Category
                                 C.Value = CStr(CatEach.catID)
                                  If C.Text = "Antiques" Then
                                   C.Checked = True
                                  End If
                                  RadTreeView1.Nodes.Add(C) 
                            Next
           End If

The treeview renders nicely but the "Antiques" checkbox remains unchecked. Any help here would be very much appreciated.
               

1 Answer, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 21 Jul 2010, 11:15 PM
Nevermind..... tristatecheckboxes was set to true and that is a bad thing.... I guess that indeterminate state or selection makes it where  c.node.checked will not happen.
Tags
TreeView
Asked by
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Share this question
or