<asp:TreeView> ShowExpandCollapse & individual nodes' SelectAction

M

Mark Rae

Hi,

Adding nodes to a TreeView programatically...

1) Instantiate a TreeNode object and set its SelectAction to
TreeNodeSelectAction.Expand.

2) Instantiate another TreeNode object and add it to the first TreeNode's
ChildNodes collection.

3) Add the first TreeNode to a TreeView's Nodes collection.

Now, when the user clicks the first TreeNode, it expands or contracts its
child nodes as expected, just as if the user had clicked the little square
box to the left of the node in question.

However, now your client tells you that he doesn't like the little square
boxes with the plus and minus signs, so you set the TreeView's
ShowExpandCollapse property to false. This, of course, removes the little
boxes but in doing so also removes the ability to expand those nodes with
child nodes - is this "normal" behaviour...?

If so, is the accepted workaround to set ShowExpandCollapse to true and to
set the TreeView's CollapseImageURL and ExpandImageURL to a transparent gif
with a size of 1px x 1px?

Any assistance gratefully received.

Mark
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top