Remove link of the text of the RadTreeNode.text

5 posts, 0 answers
  1. bits
    bits avatar
    14 posts
    Member since:
    Jun 2012

    Posted 24 Jun 2008 Link to this post

    Can i remove the link on the RadTreeNode.text so that it is not clickable but just expandable.
  2. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 24 Jun 2008 Link to this post

    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:

    1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
    2  
    3 <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    4  
    5  
    6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    7  
    8 <html xmlns="http://www.w3.org/1999/xhtml"
    9 <head runat="server"
    10     <title>Untitled Page</title> 
    11 </head> 
    12 <body> 
    13     <form id="form1" runat="server"
    14         <asp:ScriptManager ID="ScriptManager1" runat="server" />     
    15          
    16         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
    17             <script> 
    18                 function ClientNodeClicking(sender, eventArgs) 
    19                 { 
    20                     eventArgs.set_cancel(true); 
    21                 }                
    22             </script> 
    23         </telerik:RadCodeBlock> 
    24          
    25         <telerik:RadTreeView ID="RadTreeView1" runat="server"  
    26             OnClientNodeClicking="ClientNodeClicking"
    27             <Nodes> 
    28                 <telerik:RadTreeNode Text="Node 1"
    29                     <Nodes> 
    30                         <telerik:RadTreeNode Text="Node 1.1" /> 
    31                         <telerik:RadTreeNode Text="Node 1.2" /> 
    32                     </Nodes> 
    33                 </telerik:RadTreeNode> 
    34                 <telerik:RadTreeNode Text="Node 2"
    35                     <Nodes> 
    36                         <telerik:RadTreeNode Text="Node 2.1" /> 
    37                         <telerik:RadTreeNode Text="Node 2.2" /> 
    38                     </Nodes> 
    39                 </telerik:RadTreeNode> 
    40                 <telerik:RadTreeNode Text="Node 3"
    41                     <Nodes> 
    42                         <telerik:RadTreeNode Text="Node 3.1" /> 
    43                         <telerik:RadTreeNode Text="Node 3.2" /> 
    44                     </Nodes> 
    45                 </telerik:RadTreeNode> 
    46             </Nodes> 
    47             <CollapseAnimation Type="OutQuint" Duration="100" /> 
    48             <ExpandAnimation Duration="100" /> 
    49         </telerik:RadTreeView> 
    50          
    51     </form> 
    52 </body> 
    53 </html> 
    54  


    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. bits
    bits avatar
    14 posts
    Member since:
    Jun 2012

    Posted 25 Jun 2008 Link to this post

    But i want the link to be removed from the text of the radtreenode.
    Is that possible.
  5. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 25 Jun 2008 Link to this post

    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
  6. kavitha
    kavitha avatar
    16 posts
    Member since:
    Mar 2008

    Posted 01 Mar 2011 Link to this post

    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.


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