Image Web Server Control Overview

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

This topic contains:

  • Background

  • Code Examples

  • Class Reference

Background

You can specify the graphics file for an Image control at design time or at run time programmatically. You can also bind the control's ImageUrl property to a data source to display graphics based on database information.

Unlike most other Web server controls, the Image control does not support any events. For example, the Image control does not respond to mouse clicks. Instead, you can create an interactive image by using the ImageMap or the ImageButton Web server controls.

Specifying Text Elements

In addition to displaying a graphic, the Image control enables you to specify various types of text for the image, such as the following:

  • ToolTip   The text that is displayed in a tooltip in some browsers.

  • AlternateText   The text that is displayed if the graphics file cannot be found. If no ToolTip property is specified, some browsers will use the AlternateText value as a tooltip.

If the GenerateEmptyAlternateText property is set to true, the alt attribute of the rendered image element will be set to an empty string.

Back to top

Code Examples

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

Class Reference

The following table lists the classes that relate to the Image control.

Member

Description

Image

The main class for the control.

ImageAlign

An enumeration that represents the alignment options for an image relative to the text of a Web page.

Back to top

See Also

Reference

Button Web Server Controls Content Map

Concepts

HTML Image Control

Other Resources

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