This documentation is archived and is not being maintained.

HyperLink.ImageUrl Property

Gets or sets the path to an image to display for the HyperLink control.

[Visual Basic]
Public Overridable Property ImageUrl As String
[C#]
public virtual string ImageUrl {get; set;}
[C++]
public: __property virtual String* get_ImageUrl();
public: __property virtual void set_ImageUrl(String*);
[JScript]
public function get ImageUrl() : String;
public function set ImageUrl(String);

Property Value

The path to the image to display for the HyperLink control. The default value is String.Empty.

Remarks

The HyperLink control can be displayed as text or an image. Use the ImageUrl property to specify an image to display for the HyperLink control.

Note   If both the Text and ImageUrl properties are set, the ImageUrl property takes precedence. If the image is unavailable, the text in the Text property is displayed. In browsers that support ToolTip functionality, the Text property also becomes the ToolTip.

Example

[Visual Basic, C#, JScript] The following example demonstrates how to set the ImageUrl property to specify the path to the image to display.

[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 | Text

Show: