HyperLinkFor

HyperLinkFor is an editor allowing end-users to edit hyperlinks and navigate to their targets.

Implementation Details

HyperLinkFor is realized by the HyperLinkExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.HyperLinkFor<ValueType> helper method, which is used to add a HyperLinkFor extension to a view. This first method's parameter is an expression that identifies model property to display. The second method's parameter provides access to the HyperLinkFor's settings implemented by the HyperLinkSettings class, allowing you to fully customize the extension.

HyperLinkFor's client counterpart is represented by the ASPxClientHyperLink object.

Declaration

HyperLinkFor can be added to a view in the following manner.

View code (Razor):

@Html.DevExpress().HyperLinkFor(model => model.Link,
    settings => {
        settings.Properties.Text = "Go to Google";
    }
).GetHtml()

The code result is demonstrated in the image below.

hyperlink-declaration.png

See Also