TreeView & CheckBox (ASP.NET)

xiaoxiao2021-03-06  105

First set the property autopostback = "true", so there will be valid for onchange = "trecess_chkchange".

Sub TreeView2_chkchange (Byval e as treeviewclickeventargs) Handles TreeView2.check

CheckAllChildNodes (TreeView2.Getnodefromindex (E.NODE), TRUE

Session ("groups") = nodeshow (TreeView2.nodes)

Response.write ("session =" & session ("groups")))

End Sub

Sub CheckallchildNodes (Byval NodeChecked As Boolean)

Dim Node as Treenode

For Each Node in Treenode.nodes

Node.checked = nodechecked

If node.checked = true kil

If node.nodes.count> 0 THEN

Me.checkAllChildNodes (Node, NodeChecked)

END IF

END IF

NEXT

End Sub

Function Nodeshow (Byval Treenode As TreenodeCollection) AS String

Dim Node as Treenode

For Each Node in Treenode

IF node.checkbox kil

If Node.checked Then

Strowids = strgroupids & node.text & "", "

END IF

If node.nodes.count> 0 THEN

Nodeshow (node.nodes)

END IF

END IF

NEXT

Return StrGroupIDS

END FUNCTION

转载请注明原文地址:https://www.9cbs.com/read-103650.html

New Post(0)