Skip to Main Content
Programming ASP.NET 3.5, 4th Edition
book

Programming ASP.NET 3.5, 4th Edition

by Dan Maharry, Dan Hurwitz, Jesse Liberty
October 2008
Intermediate to advanced content levelIntermediate to advanced
1166 pages
28h 31m
English
O'Reilly Media, Inc.
Content preview from Programming ASP.NET 3.5, 4th Edition

Images

Images are an important aspect of most websites. ASP.NET provides several ASP.NET server controls for displaying images. Two of them, the Image and the ImageMap controls, are covered in this section. The AdRotator control, which also displays images, will be covered in the next chapter.

Image Control

The Image control has limited functionality: it is used for displaying an image on a web page or, alternatively, displaying some text if the image is unavailable. It raises no events for user interaction, other than those inherited from Control, such as Init and Load. However, which image it displays and where it is aligned on the page can be set in code, so it is a legitimate alternative to using a static HTML <img> element.

Tip

If you need an image to have the same functionality as a button (i.e., to capture mouse clicks), you should use either the ImageButton control, or a HyperLink control with its ImageUrl property set.

In addition to the properties inherited from the WebControl class, the Image control has the read/write properties shown in Table 4-7.

Table 4-7. Properties of the Image control

Name

Type

Description

AlternateText

String

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 tool tip.

ImageAlign

ImageAlign

Alignment options relative to the text of the web page. See Table 4-8.

ImageUrl

String

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

The ImageUrl property can be either relative ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Microsoft® ASP.NET 3.5

Programming Microsoft® ASP.NET 3.5

Dino Esposito
Learning ASP.NET 3.5, 2nd Edition

Learning ASP.NET 3.5, 2nd Edition

Brian MacDonald, Dan Hurwitz, Jesse Liberty
Pro ASP.Net 4 in C# 2010

Pro ASP.Net 4 in C# 2010

Matthew MacDonald, Adam Freeman, Mario Szpuszta
Programming .NET 3.5

Programming .NET 3.5

Jesse Liberty, Alex Horovitz

Publisher Resources

ISBN: 9780596156657Supplemental ContentErrata Page