.NET Framework Class Library
Image..::.ImageUrl Property

Gets or sets the URL that provides the path to an image to display in the Image control.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)
Syntax

Visual Basic (Declaration)
<BindableAttribute(True)> _
Public Overridable Property ImageUrl As String
Visual Basic (Usage)
Dim instance As Image
Dim value As String

value = instance.ImageUrl

instance.ImageUrl = value
C#
[BindableAttribute(true)]
public virtual string ImageUrl { get; set; }
Visual C++
[BindableAttribute(true)]
public:
virtual property String^ ImageUrl {
    String^ get ();
    void set (String^ value);
}
JScript
public function get ImageUrl () : String
public function set ImageUrl (value : String)
ASP.NET
<asp:Image ImageUrl="String" />

Property Value

Type: System..::.String
The URL that provides the path to an image to display in the Image control.
Remarks

Use the ImageUrl property to specify the URL of an image to display in the Image control. You can use a relative or an absolute URL. A relative URL relates the location of the image to the location of the Web page without specifying a complete path on the server. The path is relative to the location of the Web page. This makes it easier to move the entire site to another directory on the server without updating the code. An absolute URL provides the complete path, so moving the site to another directory requires that you update the code.

TopicLocation
How to: Add Image Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications in Visual Studio
How to: Add Image Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications in Visual Studio
How to: Add Image Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications
How to: Add Image Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications
How to: Add Image Web Server Controls to a Web Forms Page (Visual Studio)Building ASP .NET Web Applications in Visual Studio
How to: Add ImageButton Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications in Visual Studio
How to: Add ImageButton Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications in Visual Studio
How to: Add ImageButton Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications
How to: Add ImageButton Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications
How to: Add ImageButton Web Server Controls to a Web Forms Page (Visual Studio)Building ASP .NET Web Applications in Visual Studio
How to: Add ImageMap Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications
How to: Add ImageMap Web Server Controls to a Web Forms PageBuilding ASP .NET Web Applications
How to: Add ImageMap Web Server Controls to a Web PageBuilding ASP .NET Web Applications in Visual Studio
How to: Add ImageMap Web Server Controls to a Web PageBuilding ASP .NET Web Applications in Visual Studio
How to: Add ImageMap Web Server Controls to a Web Page (Visual Studio)Building ASP .NET Web Applications in Visual Studio
Examples

The following example demonstrates how to use the ImageUrl property to specify the location of the image to display in the Image control.

Visual Basic
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  >
<head>
    <title>Image Example</title>
</head>

<body>

   <form id="form1" runat="server">

      <h3>Image Example</h3>

      <asp:Image id="Image1" runat="server"
           AlternateText="Image text"
           ImageAlign="left"
           ImageUrl="images/image1.jpg"/>

   </form>

</body>
</html>

C#
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  >
<head>
    <title>Image Example</title>
</head>

<body>

   <form id="form1" runat="server">

      <h3>Image Example</h3>

      <asp:Image id="Image1" runat="server"
           AlternateText="Image text"
           ImageAlign="left"
           ImageUrl="images/image1.jpg"/>

   </form>

</body>
</html>

JScript
<%@ Page Language="JSCRIPT" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  >
<head>
    <title>Image Example</title>
</head>

<body>

   <form id="form1" runat="server">

      <h3>Image Example</h3>

      <asp:Image id="Image1" runat="server"
           AlternateText="Image text"
           ImageAlign="left"
           ImageUrl="images/image1.jpg"/>

   </form>

</body>
</html>

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
See Also

Reference

Other Resources

Tags :


Page view tracker