I am trying to dynamically (i.e. via code) bind a directory to a asp.net Treeview control and once the data is bound and displayed to the user i want to get a list of nodes the select.
I have got the binding and displaying of checkboxes to work fine , but when i query the Treeview1.CheckedNodes it always returns 0. If i do not bind dynamically but created the nodes by hand then it is able to get the selected nodes.
Thanks
My guess is … since you’re dynamically building the whole thing from scratch every page load you’re losing the selection.
You need to somehow store info about which checkboxes are checked before the post back (in Viewstate or Session or whatever depending on your needs) and then re-apply those selection to your tree after rebuilding it (on page load or preload if you store it in Viewstate).