This is a migrated thread and some comments may be shown as answers.

ExpandedImage is not shown if node has no childs

3 Answers 105 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 1
Robin asked on 22 Sep 2011, 12:54 PM
Hi,

is it possible to display the ExpandedImage of a node, even if the node has no childNodes (is empty)?

At the moment there is a plus sign in front of a node before you expand it.
If you expand a node which is NOT empty there will be a minus sign,
but if you expand a node which is empty there will be no minus sign (only the lines).

Is there any attribute to change this behaviour?

thank you!

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Sep 2011, 06:49 AM
Hello Robin,

Please take a look in to this forum which shows how to hide the expand/collapse image of the root node of tree.
Drop Expand/Collapse Image From Root Node

You can iterate through the nodes (and check for the nodes count) and hide the expand/collapse image using same logic described in forum.

Hope you can achieve the requirement easily.

[Note: In my case, it is not showing expand/collapse image for my simple treeview, if there are no child nodes]

Thanks,
Shinu.
0
Robin
Top achievements
Rank 1
answered on 23 Sep 2011, 07:12 AM
Hello an Thank you for the quick answer,

unfortunately i want the opposite behaviour.

I want to show the collapse image of an empty node.

At the moment there is NO collapse image if the node is empty.

thank you, Robin

0
Plamen
Telerik team
answered on 27 Sep 2011, 01:49 PM
Hi Robin,

This scenario is not supported unless you add an invisible child node as in the code bellow:
<telerik:RadTreeView runat="server" ID="RadTreeView1">
          <Nodes>
              <telerik:RadTreeNode runat="server" Text="Root RadTreeNode1">
              </telerik:RadTreeNode>
              <telerik:RadTreeNode runat="server" Text="Root RadTreeNode2">
              </telerik:RadTreeNode>
              <telerik:RadTreeNode runat="server" Text="Root RadTreeNode3" Expanded="true">
                  <Nodes>
                      <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1" Visible="false">
                      </telerik:RadTreeNode>
                  </Nodes>
              </telerik:RadTreeNode>
          </Nodes>
      </telerik:RadTreeView>

You can see the screenshot with the result here:
http://screencast.com/t/RtNINSUt

Hope  this will be helpful.

Regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
TreeView
Asked by
Robin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Robin
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or