Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

How to: Add Image Web Server Controls to a Web Forms Page 

The Image Web server control allows you to display images on an ASP.NET Web page and manage these images in your own code.

To add an Image Web server control to a Web page

  1. Type an <asp:Image> element into the page. For syntax, see Image Web Server Control Declarative Syntax.

  2. Set the control's ImageUrl property to the URL of a .gif, .jpg, or other Web graphic file.

    Security noteSecurity Note

    The URL that is associated with a Image control points to an external resource. If you point to a resource that you do not own, be sure it is safe for your users to work with. For more information, Script Exploits Overview.

  3. Optionally, set the following Image control properties.

    Property Description

    Height and Width

    Reserve space for the graphic on the page. When the page is rendered, the image will be sized to fit the space you reserve.

    ImageAlign

    Aligns the image with respect to surrounding text, using values such as Top, Bottom, Left, Middle, and Right. In code, image alignment is set by using the ImageAlign enumeration.

    AlternateText

    Displays text in place of the graphic if the graphic can't be loaded. In some browsers, this text is also displayed as a ToolTip.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft