ASP.NET AlternateText Property

Definition and Usage

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

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

The alternate text is displayed as a tooltip if the browser (Internet Explorer) supports it.

Syntax

<asp:Image AlternateText="text" runat="server" />
property description
text Specify alternate 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 Alternate Text for Images (Image Not Available)