Export (0) Print
Expand All

HyperLink.NavigateUrl Property

Gets or sets the URL to link to when the HyperLink control is clicked.

[Visual Basic]
Public Property NavigateUrl As String
[C#]
public string NavigateUrl {get; set;}
[C++]
public: __property String* get_NavigateUrl();
public: __property void set_NavigateUrl(String*);
[JScript]
public function get NavigateUrl() : String;
public function set NavigateUrl(String);

Property Value

The URL to link to when the HyperLink control is clicked. The default value is String.Empty.

Remarks

Use the NavigateUrl property to specify the URL to navigate to when the HyperLink control is clicked.

Example

[Visual Basic, C#, JScript] The following example demonstrates how to set the NavigateUrl property to specify the URL to link to when the HyperLink control is clicked.

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
<head>

</head>
<body>

   <h3>HyperLink Example</h3>

   Click on the HyperLink:<br>  

   <asp:HyperLink id="hyperlink1" 
                  ImageUrl="images/pict.jpg"
                  NavigateUrl="http://www.microsoft.com"
                  Text="Microsoft Official Site"
                  Target="_new"
                  runat="server"/>       

</body>
</html>


[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
<head>

</head>
<body>

   <h3>HyperLink Example</h3>

   Click on the HyperLink:<br>  

   <asp:HyperLink id="hyperlink1" 
                  ImageUrl="images/pict.jpg"
                  NavigateUrl="http://www.microsoft.com"
                  Text="Microsoft Official Site"
                  Target="_new"
                  runat="server"/>       

</body>
</html>


[JScript] 
<%@ Page Language="JScript" AutoEventWireup="True" %>
<html>
<head>

</head>
<body>

  <h3>HyperLink Example</h3>

   Click on the HyperLink:<br>  

   <asp:HyperLink id="hyperlink1" 
                  ImageUrl="images/pict.jpg"
                  NavigateUrl="http://www.microsoft.com"
                  Text="Microsoft Official Site"
                  Target="_new"
                  runat="server"/>       

</body>
</html>

[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HyperLink Class | HyperLink Members | System.Web.UI.WebControls Namespace

Show:
© 2015 Microsoft