[原创]在树控件中点击一个父结点,所有的子节点都被选中!

<script language="javascript">
        
function CheckNode()
         { 
         
var choose;
         
var indexid;
         indexid
=TreeView1.clickedNodeIndex;
        
         choose
=TreeView1.getTreeNode(indexid).getAttribute('Checked');
         
var NodeArray=new Array();
          NodeArray
=TreeView1.getTreeNode(indexid).getChildren();
         
for(i=0;i<NodeArray.length;i++)
        {
         
var tempindex=indexid+"."+i;
          NodeArray[i].setAttribute('Checked',choose);
        }
        }
        
</script>


    <iewc:TreeView id="TreeView1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 96px" runat="server"
                ExpandLevel
="1">
                
<iewc:TreeNode CheckBox="True" Text="Node0" Expanded="True">
                    
<iewc:TreeNode CheckBox="True" Text="Node7"></iewc:TreeNode>
                    
<iewc:TreeNode CheckBox="True" Text="Node8"></iewc:TreeNode>
                
</iewc:TreeNode>
                
<iewc:TreeNode CheckBox="True" Text="Node1" Expanded="True">
                    
<iewc:TreeNode CheckBox="True" Text="Node9"></iewc:TreeNode>
                    
<iewc:TreeNode CheckBox="True" Text="Node10"></iewc:TreeNode>
                
</iewc:TreeNode>
            
</iewc:TreeView>

Private Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load
        TreeView1.Attributes.Add(
"oncheck""CheckNode()")
    
End Sub
posted @ 2005-09-08 13:23  PointNet  阅读(2601)  评论(6编辑  收藏  举报