RadTreeView show line not 'Expanded'

6 posts, 0 answers
  1. Gerald
    Gerald avatar
    4 posts
    Member since:
    Feb 2012

    Posted 14 Jan 2013 Link to this post

    Hi,

    I am running telerik asp.net ajax 2012.2.912.40 for VS 2012.
    I see lots of documentation for RadTreeView that does not apply to the version I
    am working with.

    I need to either use ImageURL to show a line or a method call to show
    this line.
    Have already tried .Toggle(). Don't wan't to show a '-' image.

    Where are the /TreeView images located and/or what method can I call
    to show the line?
  2. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 16 Jan 2013 Link to this post

    Hi Gerald,

    I'm not exactly sure what you're asking. Do you want the lines visible or not? If you would like to change this option, all you need is to set the ShowLineImages value to true or false. As for importing images into your RadTreeView, each node can be set to an image by adding an ImageUrl field. Here is an example where I am removing the lines and adding an image to each parent node.

    <telerik:RadTreeView ID="RadTreeView1" Runat="server" ShowLineImages="False" Skin="WebBlue">
                <Nodes>
                    <telerik:RadTreeNode runat="server" Text="Fruit" ImageUrl="http://upload.wikimedia.org/wikipedia/commons/6/68/Treeview-grey-horizontal-line.png">
                        <Nodes>
                            <telerik:RadTreeNode runat="server" Text="Grapes">
                            </telerik:RadTreeNode>
                            <telerik:RadTreeNode runat="server" Text="Strawberries">
                            </telerik:RadTreeNode>
                            <telerik:RadTreeNode runat="server" Text="Watermelon">
                            </telerik:RadTreeNode>
                        </Nodes>
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Vegetables" ImageUrl="http://upload.wikimedia.org/wikipedia/commons/6/68/Treeview-grey-horizontal-line.png">
                        <Nodes>
                            <telerik:RadTreeNode runat="server" Text="Onions">
                            </telerik:RadTreeNode>
                            <telerik:RadTreeNode runat="server" Text="Peppers" ImageUrl="http://upload.wikimedia.org/wikipedia/commons/6/68/Treeview-grey-horizontal-line.png">
                                <Nodes>
                                    <telerik:RadTreeNode runat="server" Text="Green">
                                    </telerik:RadTreeNode>
                                    <telerik:RadTreeNode runat="server" Text="Red">
                                    </telerik:RadTreeNode>
                                    <telerik:RadTreeNode runat="server" Text="Jalapeno">
                                    </telerik:RadTreeNode>
                                </Nodes>
                            </telerik:RadTreeNode>
                        </Nodes>
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" BackColor="White" ImageUrl="http://upload.wikimedia.org/wikipedia/commons/6/68/Treeview-grey-horizontal-line.png" Text="Candy">
                        <Nodes>
                            <telerik:RadTreeNode runat="server" Text="Twizzlers">
                            </telerik:RadTreeNode>
                            <telerik:RadTreeNode runat="server" Text="Hershey's Chocolate">
                            </telerik:RadTreeNode>
                        </Nodes>
                    </telerik:RadTreeNode>
                </Nodes>
            </telerik:RadTreeView>

    Hopefully my example could be of some help to you. 
    Good luck,
    Bart

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gerald
    Gerald avatar
    4 posts
    Member since:
    Feb 2012

    Posted 28 Jan 2013 Link to this post

    Hi Bart,

    Thanks for the reply.

    I have seen the 'ShowLineImages' functionality already, i want to show the line in all scenarios.

    The functionality that I want to have is to not show the [-] image nor the [+] if there are no child elements and
    ONLY show the line image.


    I tried

     

    nodeDA.Attributes["style"] ="visibility:hidden;display:none";


    only to have the text and node itself disappear. I want to remove the .css style that shows the [-] image.
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Jan 2013 Link to this post

    Hi Gerald

    Try the following CSS to hide the minus image of RadTreeView
    CSS
    <style type="text/css">
         .RadTreeView_Default .rtMinus
        {
            background-image:none !important;
        }
    </style>

    Thanks,
    Princy.
  6. Gerald
    Gerald avatar
    4 posts
    Member since:
    Feb 2012

    Posted 30 Jan 2013 Link to this post

    Hi Princy,

    I tried using this from code behind in the _NodeExpand event:

    RadTreeNode nodeDA = new RadTreeNode("DetailAccounts');
    nodeDA.CssClass = "RadTreeView_Default"

    But did not work.
  7. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 04 Feb 2013 Link to this post

    Hello Gerald,

    As far as I understand your scenario, you are trying to remove the plus/minus sign when there are no child nodes of a node in the RadTreeView. In general this is the appearance of the control by design. Here is an example that demonstrates that:
    <telerik:RadTreeView ID="RadTreeView1" runat="server" >
                <Nodes>
                    <telerik:RadTreeNode runat="server" Text="Ticket">
                        <Nodes>
                            <telerik:RadTreeNode runat="server" Text="Ticket">
                                <Nodes>
                                </Nodes>
                            </telerik:RadTreeNode>
                            <telerik:RadTreeNode runat="server" Text="Equipment Request">
                            </telerik:RadTreeNode>
                            <telerik:RadTreeNode runat="server" Text="Help Desk Question">
                            </telerik:RadTreeNode>
                        </Nodes>
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Equipment Request">
                    </telerik:RadTreeNode>
                    <telerik:RadTreeNode runat="server" Text="Help Desk Question">
                    </telerik:RadTreeNode>
                </Nodes>
            </telerik:RadTreeView>

    Can you clarify if there is anything that is different in your scenario?

    Kind regards,
    Kate
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017