how to DataBind TreeView expanded property?

C

casey chesnut

i'm declaratively binding a custom XML file to ASP.NET 2.0 TreeView.
everything is working, except i don't see how to bind the 'Expanded'
property.
so right now, all of my nodes are expanded.

what should i do?

Thanks,
casey
 
V

vmssanthosh

hi
whats ur problem.. in treeview there is no property name expanded.. to
expand and collapse nodes there are two methods :Expandall() and
collapseall().. to expand or collapse a particular node means u have to
use this syntax treeview.nodes[index].expand() or collapse()...

That property expanded for the node is read only.. so u cannt change
the value of that property...
 
C

CaffieneRush

If you want to handle the expansion manually on the serverside then you
will need to hook onto and handle the TreeNodeExpanded event yourself.

http://msdn2.microsoft.com/en-us/system.web.ui.webcontrols.treeview.treenodeexpanded.aspx

Otherwise you just set the treenode's SelectAction to Expand and don't
hook onto the TreeNodeExpanded event, then the treenode would be
expanded on the clientside automagically based on the treeview you
constructed.

Regards,
Andy
 
C

CaffieneRush

By the way, in the msdn link I've provided, look at the way the
InitialExpandDepth property of TreeView is beling used.
It controls how many levels of the TreeView you display to the user
initially.

BookTreeView.InitialExpandDepth = 0 'Collapse all nodes initially.

Regards,
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top