RadEditor for ASP.NET

Custom Links Send comments on this topic.
See Also
DropDowns > Custom Links

Glossary Item Box

 

The Custom Links dropdown of Telerik RadEditor is a very convenient tool for inserting predefined hyperlinks. Those will usually be one of the following two types of links:

  • 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 using the Add method for this collection.

 

 

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

Please, note that the Add method returns XmlNode. So the code to build the tree-view above will be:

ASPX Copy Code
<rad:RadEditor id="RadEditor1" Runat="server"></rad:RadEditor>
C# Copy Code
RadEditor1.Links.Clear();
RadEditor1.Links.Add("Telerik", "http://www.telerik.com");

RadEditor1.Links
["Telerik"].Add("Products", "http://www.telerik.com/products");
RadEditor1.Links
["Telerik"]["Products"].Add("Telerik RadControls for ASP.NET suite", "http://www.telerik.com/radcontrols");
RadEditor1.Links
["Telerik"]["Products"].Add("Telerik RadNavigation suite", "http://www.telerik.com/radnavigation");
RadEditor1.Links
["Telerik"]["Products"].Add("Telerik RadEditor", "http://www.telerik.com/radeditor");
RadEditor1.Links
["Telerik"]["Products"]["Telerik RadEditor"].Add("QSF", "http://www.telerik.com/Telerik RadEditor/?Tab=Examples&Example=ServersideAPI");
RadEditor1.Links
["Telerik"].Add("Purchase", "http://www.telerik.com/purchase");
RadEditor1.Links
["Telerik"].Add("Support", "http://www.telerik.com/support");
RadEditor1.Links
["Telerik"].Add("Client.Net", "http://www.telerik.com/clientnet");
VB.NET Copy Code
RadEditor1.Links.Clear()
RadEditor1.Links.Add("Telerik", "http://www.telerik.com")

RadEditor1.Links("Telerik").Add("Products", "http://www.telerik.com/products")
RadEditor1.Links("Telerik")("Products").Add("Telerik RadControls for ASP.NET suite", "http://www.telerik.com/radcontrols")
RadEditor1.Links("Telerik")("Products").Add("Telerik RadNavigation suite", "http://www.telerik.com/radnavigation")
RadEditor1.Links("Telerik")("Products").Add("Telerik RadEditor", "http://www.telerik.com/radeditor")
RadEditor1.Links("Telerik")("Products")("Telerik RadEditor").Add("QSF", "http://www.telerik.com/Telerik RadEditor/?Tab=Examples&Example=ServersideAPI")
RadEditor1.Links("Telerik").Add("Purchase", "http://www.telerik.com/purchase")
RadEditor1.Links("Telerik").Add("Support", "http://www.telerik.com/support")
RadEditor1.Links("Telerik").Add("Client.Net", "http://www.telerik.com/clientnet")


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

ToolsFile.xml Copy Code
<links>
 
<link name="Telerik" href="http://www.telerik.com">
  <link name="Products" href="http://www.telerik.com/products">
   <link name="Telerik RadControls for ASP.NET suite" href="http://www.telerik.com/radcontrols" />
   
<link name="Telerik RadNavigation suite" href="http://www.telerik.com/radnavigation" />
   
<link name="Telerik RadEditor" href="http://www.telerik.com/radeditor">
     <link name="QSF" href="http://www.telerik.com/Telerik RadEditor"/>
   </link>
  
</link>
  
<link name="Purchase" href="http://www.telerik.com/purchase" />
  
<link name="Support" href="http://www.telerik.com/support" />
  
<link name="Client.Net" href="http://www.telerik.com/clientnet" />
 
</link>
</links>

 

Please, bear in mind that the Telerik RadEditor will persist its state (including the Custom Links set) between postbacks. 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 method of the Links collection.

 

See Also