Image.AlternateText Propriedade

Definição

Recebe ou define o texto alternativo apresentado no Image controlo quando a imagem não está disponível. Os navegadores que suportam a funcionalidade ToolTips exibem este texto como uma ToolTip.

public:
 virtual property System::String ^ AlternateText { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public virtual string AlternateText { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.AlternateText : string with get, set
Public Overridable Property AlternateText As String

Valor de Propriedade

O texto alternativo é exibido no Image controlo quando a imagem não está disponível.

Atributos

Exemplos

O exemplo seguinte demonstra como usar a AlternateText propriedade para especificar o texto alternativo a mostrar para a imagem quando esta não está disponível.

<%@ 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>
<%@ 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>

Observações

Use esta propriedade para especificar o texto a mostrar caso a imagem especificada na ImageUrl propriedade não esteja disponível. Em navegadores que suportam a funcionalidade ToolTips, este texto também é apresentado como ToolTip.

O valor desta propriedade, quando definido, pode ser guardado automaticamente num ficheiro de recurso usando uma ferramenta de design. Para mais informações, consulte LocalizableAttribute e ASP.NET Globalização e Localização.

Aplica-se a

Ver também