System.Web.UI.WebControls.Image Class

Displays an image on a Web page.

See Also: Image Members

Syntax

[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.PreviewControlDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.DefaultProperty("ImageUrl")]
public class Image : WebControl

Remarks

In this topic:

Introduction

The System.Web.UI.WebControls.Image control lets you work with images from server code. Use the System.Web.UI.WebControls.Image control to display any valid image supported by the requesting browser on the Web page. The path to the displayed image is specified by setting the Image.ImageUrl property. You can specify the text to display in place of image when the image is not available by setting the Image.AlternateText property. The alignment of the image in relation to other elements on the Web page is specified by setting Image.ImageAlign property.

Note:

This control only displays an image. If you need to capture mouse clicks on the image, use the System.Web.UI.WebControls.ImageButton control.

Accessibility

For information about how to configure this control so that it generates markup that conforms to accessibility standards, see Accessibility in Visual Studio 2010 and ASP.NET 4 and ASP.NET Controls and Accessibility.

Declarative Syntax

Example

<asp:Image
    AccessKey="string"
    AlternateText="string"
    BackColor="color name|#dddddd"
    BorderColor="color name|#dddddd"
    BorderStyle="

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0