Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I AM WORKING ON VS 2010 A SMALL PROJECT USING TREE Node.... I am working on 4.0 Frame work...
always fail tree Node ... Plz fast Reply

I also include assembly System.Web.dll ... from add refernce

C#
SignUp UR = new SignUp();
DataSet ds = UR.GetAllRegisterations();


//       ds.Relations.Add("Cat_Product", ds.Tables["Categories"].Columns["CategoryID"], ds.Tables["Products"].Columns["CategoryID"]);
ds.Relations.Add("Note", ds.Tables["SR"].Columns["SR_ID"], ds.Tables["SE"].Columns["SR_ID"]);
    
TreeNode tn ;

foreach(DataRow dr in ds.Tables["SR"].Rows)
{
    tn = new TreeNode(dr["SR_ID"].ToString());
    
    foreach (DataRow drChild in dr.GetChildRows("SE_ID"))
    {
        tn.Nodes.Add(drChild["SR_ID"].ToString());
    }
    treeView1.Nodes.Add(tn);
    
    TreeView1.Nodes.Add(tn);
}
    }

Error is .Nodes is not found.... in assembly
Posted
Updated 9-Nov-13 22:26pm
v3
Comments
Richard MacCutchan 10-Nov-13 3:36am    
Show the code where the error occurs.
kashifjaat 10-Nov-13 4:13am    
SignUp UR = new SignUp();
DataSet ds = UR.GetAllRegisterations();


// ds.Relations.Add("Cat_Product", ds.Tables["Categories"].Columns["CategoryID"], ds.Tables["Products"].Columns["CategoryID"]);
ds.Relations.Add("Note", ds.Tables["SR"].Columns["SR_ID"], ds.Tables["SE"].Columns["SR_ID"]);

TreeNode tn ;


foreach(DataRow dr in ds.Tables["SR"].Rows)
{
tn = new TreeNode(dr["SR_ID"].ToString());

foreach (DataRow drChild in dr.GetChildRows("SE_ID"))
{


tn.Nodes.Add(drChild["SR_ID"].ToString());


}
treeView1.Nodes.Add(tn);

TreeView1.Nodes.Add(tn);
}
}


Error is .Nodes is not found.... in assembly
BillWoodruff 10-Nov-13 6:45am    
Are both 'treeView1 and 'TreeView1 TreeView Controls ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900