Export (0) Print
Expand All
0 out of 8 rated this helpful - Rate this topic

Image.ImageUrl Property

Gets or sets the location of an image to display in the Image control.

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

[BindableAttribute(true)] 
public virtual string ImageUrl { get; set; }
/** @property */
public String get_ImageUrl ()

/** @property */
public void set_ImageUrl (String value)

public function get ImageUrl () : String

public function set ImageUrl (value : String)

Property Value

The location of an image to display in the Image control.

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.

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

<%@ Page Language="C#" %>
<html>
<head>

</head>
 
<body>

   <form runat="server">

      <h3>Image Example</h3>

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

</body>
</html>


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.