Edit this page
Available for: UI for ASP.NET AJAX | UI for ASP.NET MVC | UI for WPF | UI for WinForms

Hyperlinks

Hyperlinks are Fields elements, which point to a specific location. The location can be a web page or a bookmark inside the document.

The Hyperlink field exposes the following properties:

  • Uri: Specifies the URI of the hyperlink.

  • IsAnchor: Specifies whether the hyperlink points to a bookmark. The value is true if the hyperlink is pointing to a bookmark inside the document. Default value is false.

  • ToolTip: Specifies the hyperlink tooltip.

The suggested way to insert hyperlink is by using RadFlowDocumentEditor. The InsertHyperlink() method accepts the hyperlink text, URI, IsAnchor value and tooltip as parameters. The code in Example 1 shows how to insert a hyperlink to www.telerik.com:

[C#] Example 1: Insert a hyperlink

editor.InsertHyperlink("telerik", "http://www.telerik.com", false, "Telerik site");

The result looks like shown in Figure 1.

Figure 1: Hyperlink inserted in a document

Rad Words Processing Concepts Hyperlinks 01

The InsertHyperlink() method also automatically applies the Hyperlink style to the result fragment of the inserted field. More information about styles is available in the Styles article.

Hyperlinks can also point to a Bookmark inside the document. Example 2 how to create a document containing a bookmark and a hyperlink pointing to that bookmark.

[C#] Example 2: Insert a hyperlink pointing to a bookmark

RadFlowDocumentEditor editor = new RadFlowDocumentEditor(new RadFlowDocument());

// Insert bookmark.
editor.InsertBookmark("DocumentStart");
editor.InsertLine("Hello word!");

// Insert hyperlink pointing to the bookmark.
editor.InsertHyperlink("Go to start", "DocumentStart", true, "Document start");

The result of the above snippet is illustrated in Figure 2.

Figure 2: Hyperlink and bookmark in a document

Rad Words Processing Concepts Hyperlinks 02

See Also