Image.AlternateText Property
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.
[Visual Basic] Public Overridable Property AlternateText As String [C#] public virtual string AlternateText {get; set;} [C++] public: __property virtual String* get_AlternateText(); public: __property virtual void set_AlternateText(String*); [JScript] public function get AlternateText() : String; public function set AlternateText(String);
Property Value
The alternate text displayed in the Image control when the image is unavailable.
Remarks
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.
Example
[Visual Basic, C#, JScript] 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.
[Visual Basic] <%@ Page Language="VB" %> <html> <head> </head> <body> <form runat="server"> <h3>Image Example</h3> <asp:Image id="Image1" runat="server" AlternateText="Image Text" ImageAlign="left" ImageUrl="images/image1.jpg"/> </form> </body> </html> [C#] <%@ Page Language="C#" %> <html> <head> </head> <body> <form runat="server"> <h3>Image Example</h3> <asp:Image id="Image1" runat="server" AlternateText="Image Text" ImageAlign="left" ImageUrl="images/image1.jpg"/> </form> </body> </html> [JScript] <%@ Page Language="JSCRIPT" %> <html> <head> </head> <body> <form runat="server"> <h3>Image Example</h3> <asp:Image id="Image1" runat="server" AlternateText="Image Text" ImageAlign="left" ImageUrl="images/image1.jpg"/> </form> </body> </html>
[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
Image Class | Image Members | System.Web.UI.WebControls Namespace | ImageUrl