Image.ImageUrl Property
.NET Framework 3.0
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)
Image Members
System.Web.UI.WebControls Namespace
Assembly: System.Web (in system.web.dll)
'Declaration <BindableAttribute(True)> _ Public Overridable Property ImageUrl As String 'Usage Dim instance As Image Dim value As String value = instance.ImageUrl instance.ImageUrl = value
/** @property */ public String get_ImageUrl () /** @property */ public void set_ImageUrl (String value)
public function get ImageUrl () : String public function set ImageUrl (value : String)
Not applicable.
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.
| Topic | Location |
|---|---|
| How to: Add Image Web Server Controls to a Web Forms Page | Building ASP .NET Web Applications |
| How to: Add ImageButton Web Server Controls to a Web Forms Page | Building ASP .NET Web Applications |
| How to: Add ImageMap Web Server Controls to a Web Forms Page | Building ASP .NET Web Applications |
| How to: Add Image Web Server Controls to a Web Forms Page | Building ASP .NET Web Applications |
| How to: Add ImageButton Web Server Controls to a Web Forms Page | Building ASP .NET Web Applications |
| How to: Add ImageMap Web Server Controls to a Web Forms Page | Building ASP .NET Web Applications |
| How to: Add ImageMap Web Server Controls to a Web Page (Visual Studio) | Building ASP .NET Web Applications in Visual Studio |
| 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 Image Web Server Controls to a Web Forms Page (Visual Studio) | Building ASP .NET Web Applications in Visual Studio |
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="VB" %> <!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>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>
Reference
Image ClassImage Members
System.Web.UI.WebControls Namespace
Other Resources
Image Web Server ControlCommunity Additions
ADD
Show: