Export (0) Print
Expand All

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" %>
<html>
   
    <body>
      <form method=post runat=server>
  
         <a HRef="http://www.microsoft.com" runat=server> Enter site.</a>
  
      </form>
    </body>
 
 </html>
   

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

ADD
Show:
© 2014 Microsoft