Gets or sets the alternate text displayed in the Image control when the image is unavailable. Browsers that support the ToolTips feature display this text as a ToolTip.
Assembly: System.Web (in System.Web.dll)
<BindableAttribute(True)> _ Public Overridable Property AlternateText As String
[BindableAttribute(true)] public virtual string AlternateText { get; set; }
[BindableAttribute(true)] public: virtual property String^ AlternateText { String^ get (); void set (String^ value); }
[<BindableAttribute(true)>] abstract AlternateText : string with get, set [<BindableAttribute(true)>] override AlternateText : string with get, set
<asp:Image AlternateText="String" />
Property Value
Type: System.StringThe alternate text displayed in the Image control when the image is unavailable.
Use this property to specify the text to display if the image specified in the ImageUrl property is not available. In browsers that support the ToolTips feature, this text also displays as a ToolTip.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see LocalizableAttribute and ASP.NET Globalization and Localization.
The following example demonstrates how to use the AlternateText property to specify the alternate text to display for the image when the image is not available.
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Image Example</title> </head> <body> <form id="form1" runat="server"> <h3>Image Example</h3> <asp:Image id="Image1" runat="server" AlternateText="Image text" ImageAlign="left" ImageUrl="images/image1.jpg"/> </form> </body> </html>
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Image Example</title> </head> <body> <form id="form1" runat="server"> <h3>Image Example</h3> <asp:Image id="Image1" runat="server" AlternateText="Image text" ImageAlign="left" ImageUrl="images/image1.jpg"/> </form> </body> </html>
.NET Framework
Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.