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

Hyperlink as treenode

6 Answers 183 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
TelDev
Top achievements
Rank 1
TelDev asked on 25 Aug 2010, 01:09 PM
Hi,

I am new to treeview. I want to have a treeview with nodes as hyperlinks

example:
            Italian
                |-- Pizza(as hyperlink with navigate url pointing to some aspx page)
                |-- Pasta(as hyperlink with navigate url pointing to some aspx page)
           Indian
            |-- item1(as hyperlink with navigate url pointing to some aspx page)
            |-- item2(as hyperlink with navigate url pointing to some aspx page)
         Mexican
            |-- item1(as hyperlink with navigate url pointing to some aspx page)

Thanks

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 25 Aug 2010, 02:07 PM
Hello,


I hope you can apply style for the treenode which looks same as hyperlink. RadTreeNode objects have a number of properties whose value is the name of a CSS class. These properties let you alter the appearance of individual items in the menu without using a custom skin.

Some of the CSS class properties are:

 

 

CssClass
HoveredCssClass
SelectedCssClass
DisabledCssClass 

 

 

 

 

Also checkout the following link:
Understanding the Skin CSS File

Thanks,
Princy.

0
Nikolay Tsenkov
Telerik team
answered on 26 Aug 2010, 04:46 PM
Hi Aravind Guntha,

In case you meant that you want the nodes to act as hyperlinks:
- Just set the NavigateUrl property of the nodes you want to possess this behavior.

Hope this is helpful for you!


Regards,
Nikolay Tsenkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
TelDev
Top achievements
Rank 1
answered on 26 Aug 2010, 04:49 PM
Thanks for the reply

I got the same idea yesterday.

0
Gabe
Top achievements
Rank 1
answered on 01 Nov 2013, 05:57 PM
Can you set a target for the hyperlink? I'm using a RadSplitter, and I'd like a RadTreeNode hyperlink on the left pane of the splitter to open in (target?) the right pane of the splitter.

Hyperlink:

<telerik:RadTreeNode Value="Child5" Expanded="False" Text="MA Office Management" Visible="true">
                            <Nodes>
                                <telerik:RadTreeNode Value="Grandchild1" Text="Inventory Control (MICS)" NavigateUrl="http://mics.magrann.local" Target="<%= MainContent.ClientID%>" />
                            </Nodes>
                        </telerik:RadTreeNode>

Target window:
<telerik:RadPane runat="server" ID="Radpane2" Width="85%" Height="100%">
                    <asp:ContentPlaceHolder ID="MainContent" runat="server" EnableViewState="true" />
               </telerik:RadPane>
0
Hristo Valyavicharski
Telerik team
answered on 06 Nov 2013, 03:57 PM
Hi Gabe,

How do you create this node? Is it populated form a data source or you define it in the markup? If you populate it from a data source try to handle tree's NodeDataBound event and set NavigateUrl and Target properties programmatically:
protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
{
    e.Node.Target = MainContent.ClientID;
    e.Node.NavigateUrl = "http://mics.magrann.local";
}

However if the node is defined in the markup remove it and add it programmatically:
protected void Page_Load(object sender, EventArgs e)
{
  RadTreeView1.Nodes.Add(new RadTreeNode() { Text = "Node1", NavigateUrl = "http://mics.magrann.local", Target = MainContent.ClientID });
}

Then the NodeCreated event will be fired and the properties can be changed in the same manner as in the NodeDataBound event.

Regards,
Hristo Valyavicharski
Telerik
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 the blog feed now.
0
Gabe
Top achievements
Rank 1
answered on 06 Nov 2013, 06:30 PM
One more question... How do I add child nodes programmatically? I can't assign an ID to the newly created Nodes, and I don't seem to able to create the child nodes since they don't exist in the current context until PageLoad?

Thanks.

UPDATE: found documentation on this. thx.
Tags
TreeView
Asked by
TelDev
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
TelDev
Top achievements
Rank 1
Gabe
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or