System.Web.UI.WebControls Namespace Image Class
Sets or retrieves the alternative text to display if the image is unavailable.
Inline |
<asp:image alternatetext = strAltTxt ... > |
Script |
Image.AlternateText [ = strAltTxt ] |
strAltTxt |
String that specifies the alternative text to display. |
The property is read/write with no default value.
Use this property to specify the caption displayed when the image specified by the ImageUrl property is unavailable. In browsers that support tooltips, the text also displays as a ToolTip when the mouse hovers over the graphic.
Specifying alternate text assists visually impaired users, those who use speech synthesizers, those who have configured their graphical user agents not to display images, etc.
In certain cases, as when images or imagebuttons ( which inherit this property ) are used within templated controls, the AlternateText property is usually obtained dynamically from a data source.
Note that browsers differ in how they handle cases of omitted alternate text.
The following example shows how to declaratively set the AlternateText property of an Image control at design time.
<asp:image imageurl = "~/shared/aspxtreme.jpg" width=100 height=30 border=0
alternatetext = "Simply awesome" imagealign = "right" runat = "server" />
The following examples demonstrate how to dynamically bind the AlternateText property of Image or ImageButton controls defined within templates.
Image Members