Expand tree view dynamically in asp.net C# -
i have values stored in list. populating tree view code:
foreach (datarow row in resultset.tables[0].rows) { treenode newnode = new treenode(); newnode.text = row["folder_name"].tostring(); newnode.value = row["folder_code"].tostring() + "/1" + '@' + row["short_name"].tostring(); newnode.populateondemand = true; // newnode.navigateurl = "displaynodebygreed.aspx?value=" + newnode.value + ""; newnode.imageurl = "~/images/foldersmall2.jpg"; treeview_parent_child.nodes.add(newnode); } abc = (list<string>)session["submainlevel"];
in list of mine, have values stored such
1st position 2 2nd : 3 3rd : 3
now need check value of of tree has been populated initial code , expand more according values of values have in list stated above. how can go it. using code got answer on stackoverflow. below code trying execute populate , make expanded accordingly.
foreach (treenode node in treeview_parent_child.nodes) if (node.value.split('/')[0] == abc[a].split('/')[0]) expandmylitleboys(node, abc); private void expandmylitleboys(treenode node, list<string> path) { path.removeat(0); node.expand(); if (path.count == 0) return; foreach (treenode mynode in node.childnodes) if (mynode.text == path[0].split('/')[0]) expandmylitleboys(mynode, path); //recursive call }
please help. working on live project. please.
Comments
Post a Comment