TreeView2.0的CheckBox取值问题???????
提交按钮事件:
protected void btnAdd_Click(object sender, EventArgs e)
{
Bll.TDwWlBll myBll = new Bll.TDwWlBll();
IList <Model.CodeMan.TDwWlObj> listTDwWlObj = new List <Model.CodeMan.TDwWlObj> ();
FindCheck(this.TreeView1.CheckedNodes, ref listTDwWlObj);
myBll.SetDwWl(listTDwWlObj);
}
private void FindCheck(TreeNodeCollection Nds, ref IList <Model.CodeMan.TDwWlObj> listTDwWlObj)
{
foreach (TreeNode node in Nds)
{
//当选中部分checkbox时,
//为什么此处的node.Checked 总是为true????????????
if (node.Checked)
{
Model.CodeMan.TDwWlObj dwWlObj = new Model.CodeMan.TDwWlObj();
dwWlObj.Dw = this.hidDw.Value;
dwWlObj.Code = node.Value;
dwWlObj.Zgsbs = "1 ";
dwWlObj.Pxh = intPxh.ToString();
dwWlObj.Yxbj = "1 ";
listTDwWlObj.Add(dwWlObj);
intPxh += 10;
}
if (node.ChildNodes.Count > 0)
{
FindCheck(node.ChildNodes, ref listTDwWlObj);
}