asp.net.ph

Image.AlternateText Property

System.Web.UI.WebControls Namespace   Image Class


Sets or retrieves the alternative text to display if the image is unavailable.

Syntax


Inline <asp:image alternatetext = strAltTxt ... >
Script Image.AlternateText [ = strAltTxt ]

Property Value


strAltTxt String that specifies the alternative text to display.

The property is read/write with no default value.

Remarks

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.

Example

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.

Dynamically Generated ImageButtons
Run Sample | View Source
DataGrid SelectedIndexChanged Event
Run Sample | View Source
See Also

Image Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

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

You can help support asp.net.ph