在下面这个方法中不需要指定具体的treeview么?
下面这段代码是为了实现从数据库中读取数据,然后勾选treeview根节点的相应的CheckBox
不需要制定具体的treeview么 ~~可是这样我调试了下 实现不了啊 求专家高手大神!
---------------------------------------------
protected void BindTreeRoot(int userid, TreeNodeCollection treenode)
{
string sql = "";
string a = Session["userid"].ToString();
foreach (TreeNode nodes in treenode)
{
sql = "select Distinct[qxname] from userqx where userid='" + a + "'";
DataView dv = OADBHelper.GetDataTable(sql).DefaultView;
foreach (DataRowView drv in dv)
{
foreach (TreeNode node in treenode)
{
if (drv["qxname"].ToString() == node.Value.ToString())
{
node.Checked = true;
}
BindTreeRoot(Convert.ToInt16(a), node.ChildNodes);
}
}
}
}