.NET Framework Class Library
HyperLink.ImageUrl Property
Gets or sets the path to an image to display for the HyperLink control.
Assembly: System.Web (in System.Web.dll)
Syntax
Visual Basic
<BindableAttribute(True)> _ Public Overridable Property ImageUrl As String
C#
[BindableAttribute(true)] public virtual string ImageUrl { get; set; }
Visual C++
[BindableAttribute(true)] public: virtual property String^ ImageUrl { String^ get (); void set (String^ value); }
F#
[<BindableAttribute(true)>] abstract ImageUrl : string with get, set [<BindableAttribute(true)>] override ImageUrl : string with get, set
ASP.NET
<asp:HyperLink ImageUrl="String" />
Property Value
Type: System.StringThe path to the image to display for the HyperLink control. The default value is an empty string ("").
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.
Examples
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" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>HyperLink Example</title> </head> <body> <form id="Form1" runat="server"> <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"/> </form> </body> </html>
C#
<%@ Page Language="C#" AutoEventWireup="True" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>HyperLink Example</title> </head> <body> <form id="Form1" runat="server"> <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"/> </form> </body> </html>
Version Information
.NET Framework
Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
See Also
Note