Hyperlink as treenode

7 posts, 0 answers
  1. TelDev
    TelDev avatar
    32 posts
    Member since:
    Dec 2009

    Posted 25 Aug 2010 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Aug 2010 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 26 Aug 2010 Link to this post

    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
  5. TelDev
    TelDev avatar
    32 posts
    Member since:
    Dec 2009

    Posted 26 Aug 2010 Link to this post

    Thanks for the reply

    I got the same idea yesterday.

  6. Gabe
    Gabe avatar
    8 posts
    Member since:
    Jun 2012

    Posted 01 Nov 2013 Link to this post

    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>
  7. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 06 Nov 2013 Link to this post

    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.
  8. Gabe
    Gabe avatar
    8 posts
    Member since:
    Jun 2012

    Posted 06 Nov 2013 Link to this post

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