Welcome Guest Search | Active Topics | Sign In | Register

Unable to show CheckBox in TreeView Options
Brandon
Posted: Wednesday, June 18, 2008 4:48:29 AM
Rank: Member
Groups: Member

Joined: 10/11/2007
Posts: 12
I have bound data from a datatable to Treeview which works great. I cannot seem to show a check box for each node and child nodes.

I have tried including a column in the dataTable with values set to true and tried to add binding with this column and value but to no avail.

I have also tried to loop through using for each node in treeView1.nodes
still no luck

i have included the code and dataTable

Code: Visual Basic.NET
If Not dsData Is Nothing Then
                With TreeView1
                    .Nodes.Clear()
                    .AutoUncheckChildren = True
                    .AutoCheckParent = True
                    .DataSource = dsData.Tables(0)
                    .DataFields = "Level1|Level2|Level3|Level4|Level5|Level6|Level7|Level8|Level9"
                End With

                Dim Binding As New EO.Web.DataBinding()
                Binding.DataField = "SecurityBitNumber"
                Binding.Property = "Value"
                TreeView1.Bindings.Add(Binding)

                'Dim Check As New EO.Web.DataBinding()
                'Check.DataField = "CheckBox"
                'Check.Property = "ShowCheckBox"
                'TreeView1.Bindings.Add(Check)

                TreeView1.DataBind()
                LoadTreeViewSecurityMask(gexException, ddlAccessGroups.SelectedValue)

                For Each node As EO.Web.TreeNode In TreeView1.Nodes
                    node.ShowCheckBox = EO.Web.NullableBool.False
                Next


Data:
1 1 IMS IMS Run NULL NULL NULL NULL NULL NULL NULL True NULL
1 2 IMS Administration Security NULL NULL NULL NULL NULL NULL NULL True NULL
1 3 IMS Administration Security Add NULL NULL NULL NULL NULL NULL True NULL
1 4 IMS Administration Security Edit NULL NULL NULL NULL NULL NULL True NULL
1 5 IMS Administration Security Delete NULL NULL NULL NULL NULL NULL True NULL
1 6 IMS Administration Setup NULL NULL NULL NULL NULL NULL NULL True NULL
1 7 IMS Administration Setup Add NULL NULL NULL NULL NULL NULL True NULL
1 8 IMS Administration Setup Edit NULL NULL NULL NULL NULL NULL True NULL
1 9 IMS Administration Setup Delete NULL NULL NULL NULL NULL NULL True NULL
1 10 IMS Issue NULL NULL NULL NULL NULL NULL NULL NULL True NULL
1 11 IMS Issue Add NULL NULL NULL NULL NULL NULL NULL True NULL
1 12 IMS Issue Edit NULL NULL NULL NULL NULL NULL NULL True NULL
1 13 IMS Issue Delete NULL NULL NULL NULL NULL NULL NULL True NULL
1 14 IMS Reports NULL NULL NULL NULL NULL NULL NULL NULL True NULL
1 15 IMS Reports Issue Detail NULL NULL NULL NULL NULL NULL NULL True NULL

eo_support
Posted: Wednesday, June 18, 2008 8:30:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I am not sure why you use:

For Each node As EO.Web.TreeNode In TreeView1.Nodes
node.ShowCheckBox = EO.Web.NullableBool.False
Next

That set ShowCheckBox to False and it will hide the checkbox.

The easiest way is to set the TreeView1.CheckBoxImages.Visible to True. You can set this property at design time.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.