Strange idea to write another TreeView, since there are already pretty good
ones on the internet?
As I was working for another site, I had to use a TreeView, so I've seen a lot
of them (well, at least 6), and there were two main problems:
That was very disappointing, because ASP.NET is much more flexible and generates
usable HTML for all browsers I could find.
Use DHTML when possible, otherwise use server-side TreeView.
* I wasn't able to much it with many IE versions, as it is
impossible to install multiple versions or to rollback to an older version (not
much).
** As far as I could find these oldies.
2003, july 18th: corrected the CollapseExpand event (it was... half working).
Thanks to Tim Medin for pointing this bug out. Please note that in some cases
(when the Collapsed property is initially set to true in designer, if the node
is collapsed and if you just reload the page, you'll get another event another
time, so, in all cases, check your data in the node, or simply don't set its
default state to Collapsed... Sorry).
Events!
Yes! Events are here. At this
time, you can catch a specific node collapse/expand or any node
collapse/expand. Of course this system only works in server mode TreeView.
Please go to the reference
page to have (a little) more details.
Visual Designer
Also great news : there is a Visual Designer support. Just drag&drop the
TreeView control on your page, fill the blanks (the ones you want), and have
fun.
Customizable items
At last, each TreeViewItem can
be customized to use its own icons. Details are in the
reference.
This new version is dedicated to Adam Ham, who hassled me enough to give me the
envy to write this new version. No one cares about this, bu the control has
been fully rewritten in C#, but provides strictly same functionnality as the
previous.