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

Remove link of the text of the RadTreeNode.text

4 Answers 62 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
bits
Top achievements
Rank 1
bits asked on 24 Jun 2008, 02:08 PM
Can i remove the link on the RadTreeNode.text so that it is not clickable but just expandable.

4 Answers, 1 is accepted

Sort by
0
Kevin Babcock
Top achievements
Rank 1
answered on 24 Jun 2008, 08:18 PM
Hi Bits,

You can cancel any actions that occur when the RadTreeNode is clicked on the client by handling the OnClientNodeClicking event. Here is an example:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server" />     
         
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
            <script> 
                function ClientNodeClicking(sender, eventArgs) 
                { 
                    eventArgs.set_cancel(true); 
                }                
            </script> 
        </telerik:RadCodeBlock> 
         
        <telerik:RadTreeView ID="RadTreeView1" runat="server"  
            OnClientNodeClicking="ClientNodeClicking"
            <Nodes> 
                <telerik:RadTreeNode Text="Node 1"
                    <Nodes> 
                        <telerik:RadTreeNode Text="Node 1.1" /> 
                        <telerik:RadTreeNode Text="Node 1.2" /> 
                    </Nodes> 
                </telerik:RadTreeNode> 
                <telerik:RadTreeNode Text="Node 2"
                    <Nodes> 
                        <telerik:RadTreeNode Text="Node 2.1" /> 
                        <telerik:RadTreeNode Text="Node 2.2" /> 
                    </Nodes> 
                </telerik:RadTreeNode> 
                <telerik:RadTreeNode Text="Node 3"
                    <Nodes> 
                        <telerik:RadTreeNode Text="Node 3.1" /> 
                        <telerik:RadTreeNode Text="Node 3.2" /> 
                    </Nodes> 
                </telerik:RadTreeNode> 
            </Nodes> 
            <CollapseAnimation Type="OutQuint" Duration="100" /> 
            <ExpandAnimation Duration="100" /> 
        </telerik:RadTreeView> 
         
    </form> 
</body> 
</html> 
 


If you would like to read about this event further, please check out the documentation.

I hope this was helpful. If you need further assistance, please let me know.

Sincerely,
Kevin Babcock
0
bits
Top achievements
Rank 1
answered on 26 Jun 2008, 01:42 AM
But i want the link to be removed from the text of the radtreenode.
Is that possible.
0
Kevin Babcock
Top achievements
Rank 1
answered on 26 Jun 2008, 02:32 AM
Hello Bits,

If you check the markup generated by the RadTreeView, you can see that it is not created with a link, but a <span>. It's look and feel is set by the CSS and javascript set by its default or custom skin. If you'd like to change how the RadTreeNode looks, you can set the CssClass and add your own styling. If you don't like it's behavior, try intercepting some of its client-side events and changing it. You can check out some of those events here.

I hope I was helpful. If something is still not clear or you continue to have trouble, let me know and I'll try to help you further.

Sincerely,
Kevin Babcock
0
kavitha
Top achievements
Rank 1
answered on 01 Mar 2011, 01:19 PM
Is there any property of RadTreeNode which removes link in the RadTreeNode Text without changing css?
If the node does not have child nodes, i don't want to show this link on the node text.
If the node have child nodes, i want to show this link.

Thanks in advance.


Tags
TreeView
Asked by
bits
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
bits
Top achievements
Rank 1
kavitha
Top achievements
Rank 1
Share this question
or