O'Reilly logo

Programming ASP .NET by Dan Hurwitz, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Images

There are two ASP controls for displaying images: the Image control and the AdRotator control.

Image Control

The Image control has very limited functionality -- it is used for displaying an image on a web page or, alternatively, displaying some text if the image is not available. If you need to have button functionality (i.e., to capture mouse clicks), then you should use the ImageButton control, described earlier in this chapter.

In addition to the properties inherited from WebControl, the Image control has the properties shown in Table 5-16.

Table 5-16. Properties of the Image control

Name

Type

Get

Set

Values

Description

AlternateText

String

x

x

The text displayed in the control if the image is unavailable. In browsers that support the ToolTips feature, this text is also displayed as a ToolTip.

ImageAlign

ImageAlign

x

x

See Table 5-17.

Alignment options relative to the text of the web page. See Table 5-17.

ImageURL

String

x

x

The URL pointing to the location of an image to display.

The ImageURL property can be either relative or absolute. A relative URL is the location relative to the location of the web page, without specifying a fully qualified path on the server. Using relative URLs makes it easier to move an entire site without modifying any of the code, as long as the image is in a subdirectory relative to the virtual root and the same directory structure is maintained. An absoluteURL provides a fully qualified path. If the site is moved, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required