HyperLink
HyperLink is an editor allowing end-users to edit hyperlinks and navigate to their targets.
Implementation Details
HyperLink is realized by the HyperLinkExtension class. Its instance can be accessed via the ExtensionsFactory.HyperLink helper method, which is used to add a HyperLink extension to a view. This method’s parameter provides access to the HyperLink‘s settings implemented by the HyperLinkSettings class, allowing you to fully customize the extension.
HyperLink‘s client counterpart is represented by the ASPxClientHyperLink object.
Declaration
HyperLink can be added to a view in the following manner.
@Html.DevExpress().HyperLink(settings => {
settings.Name = "hyperLink1";
settings.NavigateUrl = "http://www.google.com/";
settings.Properties.Text = "Go to Google";
}).GetHtml()
Note
The Partial View should contain only the extension’s code.
The code result is demonstrated in the image below.
Main Features
The content of the editor’s hyperlink can be represented by either a caption text or an image. The editor’s caption text can be specified by the HyperLinkSettings.Properties.Text (HyperLinkProperties.Text) property. To define an image, use the HyperLinkSettings.Properties.ImageUrl (HyperLinkProperties.ImageUrl) property, which if set, has priority over the caption text.
The HyperLinkSettings.Properties.Target (HyperLinkProperties.Target) property specifies the window or frame where the hyperlinked document will be displayed.