How to hide/ visible fales RadtreeView root node ?

6 posts, 0 answers
  1. Nahid
    Nahid avatar
    31 posts
    Member since:
    Aug 2010

    Posted 05 Jan 2011 Link to this post

    Hello,

    I am developing a web application with telerik rad control. I Use the RadTreeView in my application. The all nodes are generate   from (server side) DB. This demo: http://demos.telerik.com/aspnet-ajax/treeview/examples/functionality/contextmenu/defaultcs.aspx

    I need to hide/visible false the root node of the tree.  How can I do this?

    Thanks and Regards
    Nahid

  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 06 Jan 2011 Link to this post

    Hello Nahid,

    If you're getting your results from the database, just exclude the root node from the query. So excluding records where the ParentID is not null. That way it will not show up in the RadTreeView.

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bader
    Bader avatar
    215 posts
    Member since:
    Aug 2008

    Posted 29 Aug 2011 Link to this post

    Hello,

    I have the same problem, I tried your suggestion, but the result is that all rdatreeview items are not visible any more (Not just the root node).

    My code:
    <asp:SqlDataSource ID="GuideSqlDataSource" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:GuidesConnectionString %>" 
                        SelectCommand="SELECT [SerID], ([Type] + '~/Guides/Pages/' + [Path] + '.aspx') as TypeAndFullPath, [ParentID], [Title], [Type] FROM [QAGuide] where ParentID <> NULL  order by [Type],[Title]"></asp:SqlDataSource>
                    <telerik:RadTreeView ID="GuideRadTreeView" runat="server" OnNodeDataBound="QAGuideRadTreeView_NodeDataBound" OnNodeClick="QAGuideRadTreeView_NodeClick" DataValueField="TypeAndFullPath"
                        DataSourceID="GuideSqlDataSource" DataFieldParentID="ParentID" DataFieldID="SerID" DataTextField="Title"  >
                        <DataBindings>
                            <telerik:RadTreeNodeBinding Depth="0" Expanded="true" />
                        </DataBindings>
                    </telerik:RadTreeView>

    Please, I need your help in order to hide only the root node.
    It is very appreciated to send me the modified code.

    Regards,
    Bader
  5. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 31 Aug 2011 Link to this post

    Hi Bader,

    The query string seems right, could you check what is the returned result from the data source?

    Greetings,
    Dimitar Terziev
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Bader
    Bader avatar
    215 posts
    Member since:
    Aug 2008

    Posted 01 Sep 2011 Link to this post

    Hello,

    Thank you for your reply,
    Find attached screen-shot.

    Please, I need your help.
    It is very appreciated to send me the modified code.

    Regards,
    Bader
  7. Nikhil
    Nikhil avatar
    9 posts
    Member since:
    Oct 2011

    Posted 13 Mar 2012 Link to this post

    Hi friends,


    I am sure there is no way to hide the root node in telerik RadtreeView or RadtreeList since all the reply seems diverting from the question asked over here to telerik team.
    and you are right my friend, if we exclude root node in the query (fetching nodes from database) then nothing will be bind(nothing will be show in the tree).

    So, My advice is not to go for more research for this question.


    Thanks
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017