treeview动态生成树的问题) 生成页节点出现问题
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataView dv = drv( "select * from tree_node0 ");
foreach (DataRowView dr in dv)
{
TreeNode tn = new TreeNode();
tn.Text = dr[ "tree_name "].ToString();
tn.Value = dr[ "tree_id "].ToString(); //tree_id是44444444-4444-4444-4444-44444444444类型的
tn.Expanded = false;
TreeView1.Nodes.Add(tn);
childnode(tn);
}
}
}
protected void childnode(TreeNode tn)
{
string second =Convert.ToString(tn.Value).ToString();
DataView dv = drv( "select * from tree_node1 where tree_id= "+second);
foreach (DataRowView dr in dv)
{
TreeNode tn_1 = new TreeNode();
tn_1.Text = dr[ "tree_name1 "].ToString();
tn_1.Value = dr[ "tree_id1 "].ToString();
tn_1.NavigateUrl = "ads.aspx "+dr[ "tree_id1 "].ToString();
tn.ChildNodes.Add(tn_1);
}
}
private DataView drv(string str)
&nb