HtmlAnchor.HRef Property
Gets or sets the URL target of the link specified in the HtmlAnchor server control.
[Visual Basic] Public Property HRef As String [C#] public string HRef {get; set;} [C++] public: __property String* get_HRef(); public: __property void set_HRef(String*); [JScript] public function get HRef() : String; public function set HRef(String);
Property Value
The URL target of the link.
Remarks
Use this property to specify the URL to link to when the HtmlAnchor is clicked.
Example
[Visual Basic, C#, JScript] The following example demonstrates how to use the HRef property to specify a Web page to navigate to when the HtmlAnchor is clicked.
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <body> <form method=post runat=server> <a HRef="http://www.microsoft.com" runat=server> Enter site.</a> </form> </body> </html> [C#] <%@ 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> [JScript] <%@ Page Language="JScript" AutoEventWireup="True" %> <html> <body> <form method=post runat=server> <a HRef="http://www.microsoft.com" runat=server> Enter site.</a> </form> </body> </html>
[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
HtmlAnchor Class | HtmlAnchor Members | System.Web.UI.HtmlControls Namespace