ASP.NET Web Forms HyperLink Control: Creating and Customizing Hyperlinks

Learn how to use the HyperLink control in ASP.NET Web Forms to create and customize hyperlinks on your web pages. This tutorial explains the HyperLink control's properties, demonstrates its usage with code examples, and shows how to create interactive hyperlinks within your ASP.NET applications.



ASP.NET Web Forms HyperLink Control

Introduction to the HyperLink Control

The HyperLink control in ASP.NET Web Forms creates hyperlinks on a web page. It's a server-side control, meaning it's processed on the server before being sent to the client's browser. The HyperLink control generates standard HTML anchor tags (`<a>`) when rendered. This control responds to click events, allowing you to navigate to different pages or resources.

Creating a HyperLink Control

You can create a HyperLink control either visually using the Visual Studio IDE or by writing code directly into your ASPX file. Here's an example using ASP.NET syntax:

Syntax

<asp:HyperLink ID="HyperLink1" runat="server" Text="JavaTpoint" NavigateUrl="https://tutorialsarena.com/"></asp:HyperLink>
Rendered HTML Output

<a href="https://tutorialsarena.com/">JavaTpoint</a>

HyperLink Control Properties

The HyperLink control offers various properties for customization:

Property Description
AccessKey Sets a keyboard shortcut.
TabIndex Specifies the tab order.
BackColor Sets the background color.
BorderColor Sets the border color.
BorderWidth Sets the border width.
Font Sets the font style.
ForeColor Sets the text color.
Text Sets the displayed text.
ToolTip Text displayed on hover.
Visible Controls visibility.
Height Sets the height.
Width Sets the width.
NavigateUrl Specifies the target URL.
Target Specifies the target frame (e.g., "_blank").