ASP.NET AlternateText property

Definition and usage

The AlternateText property is used to set or return the alternative text of the image.

This property specifies the text to be displayed if the image is not available.

If supported by the browser (Internet Explorer), the alternative text will be displayed as a tooltip.

Syntax

<asp:Image AlternateText="text" runat="server" />
Property Description
Text Specify alternative text for the image.

Example

The following example sets the AlternateText property for the Image control:

<form runat="server">
<asp:Image id="Img1" ImageUrl="img.gif"
runat="server" AlternateText="Image Text" />
</form>

Example

Set alternative text for images (image not available)