Hello
I am having three major problems with the TreeView control:
1. All AutoCheck-Properties don't work. For example, when the user checks a parent node, its child nodes won't be checked automatically, and vice versa.
2. When checking or unchecking a node, no postback is sent, even with RaisesServerEvent="true"
3. When the page ist posted back via a submit button, it is not possible in the code behind to iterate through the tree's nodes and determine which nodes have been checked by the user (using the Checked-Property of each node).
Here's my code:
Code: HTML/ASPX
<EO:TreeView runat="server" ID="trvRechte" AllowMultiSelect="true" AutoCheckChildren="true"
AutoCheckParent="true" AutoUncheckChildren="true" EnableScrolling="true" RaisesServerEvent="true" OnItemCheckStateChanged="trvRechte_CheckStateChanged" >
<TopGroup>
<TemplateItem>
<CustomItem>
<asp:CheckBox CssClass="normal" runat="server" Text='<%#Eval("Form")%>'
Style="white-space: nowrap" ID="Checkbox1"></asp:CheckBox>
</CustomItem>
<SubGroup>
<TemplateItem>
<CustomItem>
<asp:CheckBox CssClass="normal" Runat="server" Text='<%#Eval("Control")%>' style="white-space:nowrap" ID="Checkbox2" Checked='<%#Eval("IstBerechtigt")%>'>
</asp:CheckBox>
</CustomItem>
</TemplateItem>
</SubGroup>
</TemplateItem>
<Bindings>
<EO:DataBinding Property="Value" DataField="ID" Depth="2" />
</Bindings>
</TopGroup>
</EO:TreeView>
Code behind:
Code: Visual Basic.NET
Dim sql As String = "Delete From fs_Berechtigung Where fRolleID = " & newRolle.ID & "; "
For Each formNode As EO.Web.TreeNode In trvRechte.Nodes
If formNode.Checked Then
sql &= "Insert Into fs_Berechtigung (fRolleID, fFunktionID) values (" & newRolle.ID & ", " & formNode.Value & "); "
End If
For Each controlNode As EO.Web.TreeNode In formNode.ChildNodes
If controlNode.Checked Then
sql &= "Insert Into fs_Berechtigung (fRolleID, fFunktionID) values (" & newRolle.ID & ", " & controlNode.Value & "); "
End If
Next
Next
After execution of this code the sql still has its initial value, even if some or all nodes were checked.
Am I missing something??? Thanks.