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

How to hide/ visible fales RadtreeView root node ?

5 Answers 390 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Nahid
Top achievements
Rank 1
Nahid asked on 05 Jan 2011, 03:28 PM

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

5 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 06 Jan 2011, 03:05 PM
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.
0
Bader
Top achievements
Rank 1
answered on 29 Aug 2011, 09:58 AM
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
0
Dimitar Terziev
Telerik team
answered on 31 Aug 2011, 03:02 PM
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 >>

0
Bader
Top achievements
Rank 1
answered on 01 Sep 2011, 07:39 AM
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
0
Nikhil
Top achievements
Rank 1
answered on 13 Mar 2012, 05:39 AM
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
Tags
TreeView
Asked by
Nahid
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Bader
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Nikhil
Top achievements
Rank 1
Share this question
or