HtmlAnchor.HRef Property

Gets or sets the URL target of the link specified in the HtmlAnchor server control.

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)

public string HRef { get; set; }
/** @property */
public String get_HRef ()

/** @property */
public void set_HRef (String value)

public function get HRef () : String

public function set HRef (value : String)

Property Value

The URL target of the link.

Use this property to specify the URL to link to when the HtmlAnchor control is clicked.

The following code example demonstrates how to use the HRef property to specify a Web page to navigate to when the HtmlAnchor control is clicked.

<%@ Page Language="C#" AutoEventWireup="True" %>
      <form method=post runat=server>
         <a HRef="" runat=server> Enter site.</a>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions