DataTable dtGroupName = Cheeli.DBUtility.DbHelperSQL.GetDataTable("select distinct GroupName from SysRes"); foreach (DataRow rows in dtGroupName.Rows)
{
string GroupName = rows["GroupName"].ToString();
TreeNode root = new TreeNode(GroupName);
tvPermissions.Nodes.Add(root);
SqlParameter[] parameters = { new SqlParameter("@GroupNameText", root.Text) };
string sql = "select * from SysRes where GroupName=@GroupNameText";
DataTable dt = Cheeli.DBUtility.DbHelperSQL.GetDataTable(sql, parameters); foreach (DataRow row in dt.Rows)
{
string PromiseName = row["PromiseName"].ToString();
TreeNode node = new TreeNode(PromiseName);
node.Name = row["Id"].ToString();
root.Nodes.Add(node);
}
}
treeview控件click的时候用selectNode就能获取。
没明白,什么时候要获得?