关于ASP.NET中TreeView用法的一个小例子(2)

//第三个节点
    void PopulateProducts(TreeNode node)
    {
        DataTable dt = new DataTable();
        QueryParam queryparam = new QueryParam();
        queryparam.Add("ProductTypeItemID", QueryParam.RELATION.EQ, "" + node.Value + "");
        dt = product.GetList(queryparam);

if (dt.Rows.Count > 0)
        {
            foreach (DataRow row in dt.Rows)
            {
                TreeNode NewNode = new TreeNode(row["ProductName"].ToString(), row["ProductID"].ToString(), "", "../WebProductDetaile.aspx?productID=" + row["ProductID"].ToString() + "", "");
                //NewNode.PopulateOnDemand = false;
                //NewNode.SelectAction = TreeNodeSelectAction.None;
                NewNode.PopulateOnDemand =true ;
                NewNode.SelectAction = TreeNodeSelectAction.Expand ;
                node.ChildNodes.Add(NewNode);
                node.Expanded = false;
            }
        }
    }


}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjgypg.html