System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.WebControls.WebControl 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")

In this topic:

Introduction

Accessibility

Declarative Syntax

## Introduction

The control lets you work with images from server code. Use the 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 property. You can specify the text to display in place of image when the image is not available by setting the property. The alignment of the image in relation to other elements on the Web page is specified by setting property.

This control only displays an image. If you need to capture mouse clicks on the image, use the 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

`<asp:Image AccessKey="string" AlternateText="string" BackColor="color name|#dddddd" BorderColor="color name|#dddddd" BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| Inset|Outset" BorderWidth="size" CssClass="string" DescriptionUrl="uri" Enabled="True|False" EnableTheming="True|False" EnableViewState="True|False" ForeColor="color name|#dddddd" GenerateEmptyAlternateText="True|False" Height="size" ID="string" ImageAlign="NotSet|Left|Right|Baseline|Top|Middle|Bottom| AbsBottom|AbsMiddle|TextTop" ImageUrl="uri" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Style="string" TabIndex="integer" ToolTip="string" Visible="True|False" Width="size" />`

Displays an image on a Web page.

- Constructor

  Use this constructor to create and initialize a new instance of the class.

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` To be added

  Adds the attributes of an to the output stream for rendering on the client.

  A that contains the output stream to render on the client browser. 1.0.5000.0 2.0.0.0
- Property
  System.String To be added: an object of type 'string'

  Use this property to specify the text to display if the image specified in the property is not available. In browsers that support the ToolTips feature, this text also displays as a ToolTip.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the alternate text displayed in the control when the image is unavailable. Browsers that support the ToolTips feature display this text as a ToolTip.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Localizable(true)
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.Bindable(true)
- Property
  1.0.5000.0
  2.0.0.0
  System.Web.UI.UrlProperty
  System.ComponentModel.Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.ComponentModel.DefaultValue("")
  System.String To be added.

  The property specifies an HTML file that provides additional details for the image. The property renders as the longdesc attribute for the image control. If the property is not set, or is set to an empty string (""), the control renders without the longdesc attribute.

  Use the property to supplement the property. For example, if you use an control to display an image of the solar system, you can set the property to The Solar System, and then set the property to an HTML page that further describes the image of planets orbiting the sun in the solar system.

  The property is optional, but it can enhance the accessibility of your Web page for text-only browsers and screen readers. Browsers can use the detailed text description to convey important concepts in place of, or in addition to, the visual image. Refer to your browser documentation for details on how it uses the descriptive content specified by the longdesc attribute.

  Gets or sets the location to a detailed description for the image.

- Property
  System.Boolean a

  This property is inherited from the class and is not applicable to the control.

  Gets or sets a value indicating whether the control is enabled.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)
  System.ComponentModel.Browsable(false)
- Property
  System.Web.UI.WebControls.FontInfo a

  This property is inherited from the class and is not applicable to the control.

  Gets the font properties for the text associated with the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
- Property
  2.0.0.0
  System.ComponentModel.DefaultValue(false)
  System.Boolean To be added.

  By default, when the property is not set, the control does not include the alt attribute to specify the alternate text in the control rendering. Set the property to true to always include the alternate text attribute in rendered output for the control.

  The XHTML document type definition requires the alt attribute on image controls. However, accessibility best practices recommend that image controls that do not convey information relevant to the context of the Web page should not specify an alt attribute. You can meet both XHTML and accessibility requirements by setting the property to true.

  Gets or sets a value indicating whether the control generates an alternate text attribute for an empty string value.

- Property
  System.Web.UI.WebControls.ImageAlign To be added: an object of type 'ImageAlign'

  Use the property to specify or determine the alignment of the image in relation to other elements on the Web page. The following table lists the possible alignments.

  Alignment

  Description

  NotSet

  The alignment is not set.

  Left

  The image is aligned on the left edge of the Web page with text wrapping on the right.

  Right

  The image is aligned on the right edge of the Web page with text wrapping on the left.

  Baseline

  The lower edge of the image is aligned with the lower edge of the first line of text.

  Top

  The upper edge of the image is aligned with the upper edge of the highest element on the same line.

  Middle

  The middle of the image is aligned with the lower edge of the first line of text.

  Bottom

  The lower edge of the image is aligned with the lower edge of the first line of text.

  AbsBottom

  The lower edge of the image is aligned with the lower edge of the largest element on the same line.

  AbsMiddle

  The middle of the image is aligned with the middle of the largest element on the same line.

  TextTop

  The upper edge of the image is aligned with the upper edge of the highest text on the same line.

  Gets or sets the alignment of the control in relation to other elements on the Web page.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(System.Web.UI.WebControls.ImageAlign.NotSet)
- Property
  System.String To be added: an object of type 'string'

  Use the property to specify the URL of an image to display in the 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.

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

  1.0.5000.0
  2.0.0.0
  System.Web.UI.UrlProperty
  System.ComponentModel.Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.Bindable(true)
- Method
  System.Void ``

  The method is primarily used by control developers. The control implements the method to skip rendering of any child controls.

  Renders the image control contents to the specified writer.

  An that represents the output stream to render HTML content on the client. 1.0.5000.0 2.0.0.0