c# - Adding child nodes to Treeview Control ASP.Net -


i trying add child nodes parent nodes in treeview control. runs fine in degbugger, looks if getting added, can see parent nodes. can shine little light on this. thanks.

foreach (var item in agencylistroot) {      treenode parentnode = new treenode();      treenode childnode = new treenode();       if (item.heirid.tostring() == "/1/")      {           parentnode.text = item.agencyname.tostring();           tv_agencies.nodes.add(parentnode);       }       if (item.heirid.tostring() == "/1/2/")      {          childnode.text = item.agencyname.tostring();          parentnode.childnodes.add(childnode);      } } 

may code helps you..

    foreach (datarow dr in dttree.select("parent_id null")) // each parent node in table or else     {     treenode node = new treenode(dr["name"].tostring(), dr["s_no"].tostring());     treeview1.nodes.add(node); // adding parent node treeview     string serial_no = dr["s_no"].tostring(); // store parent node value or text in variable     foreach(datarow dr1 in dttree.select("parent_id = '"+serial_no+"'")) // child node of parent node     {         treenode child_node = new treenode(dr1["name"].tostring(), dr1["s_no"].tostring());         node.childnodes.add(child_node);// here adding child node particular parent node.     }     } 

if want table structure means. create table this.

thanks , regards, ganesh. s


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -