Export (0) Print
Expand All

Hyperlink control

The HyperLink control creates links on a web page that allow users to move from page to page in your application. The HyperLink control can display clickable text or an image. Unlike most ASP.NET controls, the HyperLink control does not raise an event in server code when users click it. Instead, the control simply performs navigation.

  1. Drag the HyperLink control from the Toolbox panel to your page.

  2. In the Tag Properties panel, set properties for the control.

Common HyperLink control properties

Property

Description

Text

Specifies the text displayed as a hyperlink in the user's browser. You can include HTML formatting in the property.

CssClass

Specifies a style for the hyperlink. When you use the Microsoft Expression Web CSS tools to apply a style to the control, this property is automatically updated.

ImageUrl

Creates a graphical link when you set the property to the URL of a .gif, .jpg, or other web graphic file. If you set both the ImageUrl and Text properties, the ImageUrl property takes precedence.

NavigateUrl

Specifies the URL of the page to which you want to link.

Target

Indicates the ID of a target window or frame in which to display the linked page. You can either specify a window by name or use predefined target values, such as _top, _parent, and so on.

For a full description of all HyperLink control properties, see HyperLink Properties in the MSDN library.

The primary advantage of using a HyperLink control is that you can set link properties in server code. For example, you can dynamically change the link text or target page based on conditions in your page.

Another advantage of using the HyperLink control is that you can use data binding to specify the target URL for the link (and parameters to be passed with the link, if necessary). A typical example is to create HyperLink controls based on a list of products; the target URL points to a page where the user can read more detail about the product.

Cc295443.alert_note(en-us,Expression.30).gifNote:

The URLs associated with a HyperLink can be tampered with by a malicious user. For more information, see How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings in the MSDN library.

For more information about working with the HyperLink control, see HyperLink Web Server Control in the MSDN library.

Community Additions

ADD
Show:
© 2014 Microsoft