C# - The Image Class

The Image Web control is used to display an image on the page.

Properties of the Image Class

Item Description
Properties
AlternateText Specifies the text to be displayed if the user has images turned off
ImageAlign Aligns the rendered image on the page
ImageUrl Specifies the URL to display when the user clicks on the image
Image.AlternateText

Syntax

String AlternateText

Description

The Image.AlternateText property contains the text to be displayed if the user has images turned off or if the user's browser does not support images.

Example

MyImage.AlternateText = "Golden Fish";
Image.ImageAlign

Syntax

ImageAlign ImageAlign

Description

The Image.ImageAlign property is used to align the rendered image on the page.

Example

MyImage.ImageAlign = ImageAlign.Left;
Image.ImageUrl

Syntax

String ImageUrl

Description

The Image.ImageUrl property is used to specify a URL to display to the user when he or she clicks on the image.

Example

MyImage.ImageUrl = "http://www.google.com/";