asp.net.ph

Skip Navigation Links

Image Control Syntax

ASP.NET Syntax   ASP.NET Syntax for Web Controls


Displays a Web-compatible image on the Web Forms page.

Declarative Syntax

For information on the individual members of this class, see Image in the class library.

Properties


Property Description
Base properties The properties inherited from the base WebControl class.
AlternateText Text to display if the image referenced by ImageUrl is not available. In some browsers, the alternate text is displayed as a ToolTip when the user holds the mouse pointer over the image.
ImageAlign The alignment of the image with surrounding text. The default is NotSet.

When programming, you set this property using the ImageAlign enumeration.

ImageUrl The URL of the image to display.

Remarks

Use the Image control to display an image on a Web Forms page. Setting the ImageUrl property specifies the path to the displayed image. You can specify the text to display in place of the image when the image is not available by setting the AlternateText property. The alignment of the image in relation to other elements on the Web Forms page is specified by setting ImageAlign property.

NOTE: This control only displays an image. If you need to capture mouse clicks on the image, use the ImageButton control.

Syntax Example

The below code snippet demonstrates how to use the Image control to display an image on a Web Forms page.

<asp:image id="imgEarth" runat="server" 
   imageurl = "/asp.net.ph/shared/images/earth.gif" 
   alternatetext = "Earth" />
Earth
See Also

Image Class   Image Web Server Control



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note