TreeView复选框问题 [英] TreeView CheckBoxes Problem

查看:132
本文介绍了TreeView复选框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

我已经填充了一个树形视图.有子节点,那些也有子节点,依此类推.现在,在编辑时,我正在获取包含树视图节点值的数据表.并且在此基础上,我需要在页面加载时选中"复选框.我只能通过使用下面的代码来获取父节点.但是无法获取子节点.

Hi everyone...

I have populated a treeview. There are child nodes and those also have the child nodes and so on. Now at the time of edit, I am getting the datatable containing the treeview node values. and on the basis of that I need to make "checked" the check boxes at the time of page load. I am getting the Parent nodes only by using the following code below. But unable to get the child nodes.

DataTable dt = ds1.Tables[0];
foreach (TreeNode node in TreeViewArticleCatagory.Nodes)
{
    foreach (DataRow dr in dt.Rows)
    {
        if (Convert.ToString(dr["Item"]) == node.Value)
        {
            node.Checked = true;
            //TreeViewArticleCatagory.SelectedNode.Checked = true;
        }
    }
}


请帮帮我....

在此先感谢.....

[edit]插入代码块以保留格式-OriginalGriff [/edit]


Please help me....

Thanks in advance.....

[edit]Code block inserted to preserve formatting - OriginalGriff[/edit]

推荐答案

尝试查看node.Nodes-这是此节点的子节点列表.
Try looking at node.Nodes - it is a list of child nodes for this node.


这篇关于TreeView复选框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆