Treeview - How to "delete" unwanted node lines programmatically
my treeview consists of the newslines with dates. The user can filter by specifing "today", under 1 week", "under 1 month", etc to make Treeview's list shorter or longer.
For shorter list, I can remove the older lines that have no child nodes. I am struggling to find the method how to remove or hide the older lines with child nodes. I know it is definitely to do with tn.PopulateOnDemand (TreeView1_TreeNodePopulate).
What I am trying is to "hold" all the older lines with child nodes until I find the leaf node to check the date whether it is older or not. If older, I want to remove all the linking nodes. Otherwise, leave them.
Please excuse if this explana开发者_运维百科tion is not clear as I try harder to envision that problem.
It is for ASP NET - Visual Studio 2008.
Appreciate any responses.
Tony
Look at the TreeNodeCollection.Remove method. There's a sample showing how to use it on the documentation page.
精彩评论