New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Custom Links

The RadEditor Custom Links dropdown is a convenient tool for inserting pre-defined hyperlinks. These usually be one of two link types:

  • Internal site links (i.e. links to other pages of the web-site). You can preload the Custom Links treeview with the complete structure of your site so that the end-users would just need to select a page from the dropdown (e.g."About-us -> History").

  • Frequently used external links (e.g. Google).

Custom links are kept in the Links collection. You can add a new custom link to the Links collection declaratively, programmatically and using the ToolsFile.

The example below demonstrates how to add a sublist in the Custom Links dropdown treeview. The parent node is the Telerik link and its childs are Telerik Products, Telerik Support Center and Telerik Community:

<telerik:radeditor runat="server" ID="RadEditor1">    
        <telerik:EditorLink Name="Telerik" Href="">            
        <telerik:EditorLink Name="Telerik Products" Href="" Target="_blank" />            
        <telerik:EditorLink Name="Telerik Support Center" Href="" Target="_blank" />            
        <telerik:EditorLink Name="Telerik Community" Href="" Target="_blank" ToolTip="Telerik Community" />        

In the following example, we construct a simple 3-level Custom Links treeview:

Telerik.Web.UI.EditorLink telerik = new Telerik.Web.UI.EditorLink();
telerik.Name = "Telerik";
telerik.Href = "";
telerik.ToolTip = "Telerik";
Telerik.Web.UI.EditorLink support = new Telerik.Web.UI.EditorLink();
support.Name = "Telerik Support";
support.Href = "";
support.ToolTip = "Telerik Support Center";
Telerik.Web.UI.EditorLink forums = new Telerik.Web.UI.EditorLink();
forums.Name = "Telerik Forums";
forums.Href = "";
forums.ToolTip = "Telerik Forums";

RadEditor1.Links.Add(telerik); // Adds the telerik link to the Links dropdown
telerik.ChildLinks.Add(support); //Adds the support link as a child of the telerik link
support.ChildLinks.Add(forums); //Adds the forums link as a child of the support link           
Dim telerik As New Telerik.Web.UI.EditorLink()
telerik.Name = "Telerik"
telerik.Href = ""
telerik.ToolTip = "Telerik"
Dim support As New Telerik.Web.UI.EditorLink()
support.Name = "Telerik Support"
support.Href = ""
support.ToolTip = "Telerik Support Center"
Dim forums As New Telerik.Web.UI.EditorLink()
forums.Name = "Telerik Forums"
forums.Href = ""
forums.ToolTip = "Telerik Forums"

' Adds the telerik link to the Links dropdown
'Adds the support link as a child of the telerik link
'Adds the forums link as a child of the support link

Using the ToolsFile

You can also populate the Custom Links treeview using the ToolsFile.xml file, as shown in the example below:

 <tools name="MainToolbar" enabled="true">
   <tool name="InsertCustomLink" />
   <link name="Telerik" href="">
     <link name="Products" href="">
       <link name="Telerik® UI for ASP.NET AJAX suite" href="" />
       <link name="Telerik RadNavigation suite" href="" />
       <link name="Telerik RadEditor" href="">
         <link name="QSF" href=" RadEditor"/>
     <link name="Purchase" href="" />
     <link name="Support" href="" />
     <link name="Client.Net" href="" />

Please bear in mind that RadEditor will persist its state (including the Custom Links set) between post backs. In order to create a new set of Custom Links (e.g. for different users), you will need to clear it first. This can be done using Remove() or Clear() methods of the Links collection.

See Also

In this article