Image.AlternateText Proprietà

Definizione

Ottiene o imposta il testo alternativo visualizzato nel controllo Image quando l'immagine non è disponibile. Nei browser che supportano la funzione di descrizione comandi, il testo viene visualizzato come descrizione.

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

Valore della proprietà

Il testo alternativo visualizzato nel controllo Image quando l'immagine non è disponibile.

Attributi

Esempio

Nell'esempio seguente viene illustrato come utilizzare la AlternateText proprietà per specificare il testo alternativo da visualizzare per l'immagine quando l'immagine non è disponibile.

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

Commenti

Utilizzare questa proprietà per specificare il testo da visualizzare se l'immagine specificata nella ImageUrl proprietà non è disponibile. Nei browser che supportano la funzionalità Descrizioni comandi, questo testo viene visualizzato anche come descrizione comando.

Il valore di questa proprietà, se impostato, può essere salvato automaticamente in un file di risorse usando uno strumento di progettazione. Per altre informazioni, vedere LocalizableAttribute e ASP.NET Globalizzazione e localizzazione.

Si applica a

Vedi anche