AdCreatedEventArgs.AlternateText Proprietà

Definizione

Ottiene o imposta il testo alternativo visualizzato nel controllo AdRotator quando l'immagine dell'annuncio pubblicitario non è disponibile. Nei browser che supportano la funzionalità di descrizione comandi, questo testo è visualizzato come descrizione comandi dell'annuncio.

public:
 property System::String ^ AlternateText { System::String ^ get(); void set(System::String ^ value); };
public string AlternateText { get; set; }
member this.AlternateText : string with get, set
Public Property AlternateText As String

Valore della proprietà

Testo visualizzato al posto dell'immagine dell'annuncio pubblicitario se l'immagine non è disponibile. Il valore predefinito è Empty.

Esempio

Nell'esempio di codice seguente viene illustrato come impostare la AlternateText proprietà a livello di codice.

<%@ Page Language="C#" AutoEventWireup="True" %>

<!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 runat="server">
    <title>AdCreatedEventArgs AlternateText Example</title>
<script runat="server">
   
       void AdCreated_Event(Object sender, AdCreatedEventArgs e) 
       {

          e.AlternateText = "New Alternate Text Value";   
       
       }      

   </script>
 
</head>
 
<body>
 
   <form id="form1" runat="server">
 
      <h3>AdCreatedEventArgs AlternateText Example</h3>
 
      <asp:AdRotator id="AdRotator1" runat="server"
           AdvertisementFile = "Ads.xml"
           Target="_newwwindow"
           OnAdCreated="AdCreated_Event"/>
 
   </form>
 
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>

<!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 runat="server">
    <title>AdCreatedEventArgs AlternateText Example</title>
<script runat="server">
   
       Sub AdCreated_Event(sender As Object, e As AdCreatedEventArgs) 
       
          e.AlternateText = "New Alternate Text Value"   
       
       End Sub      

   </script>
 
</head>
 
<body>
 
   <form id="form1" runat="server">
 
      <h3>AdCreatedEventArgs AlternateText Example</h3>
 
      <asp:AdRotator id="AdRotator1" runat="server"
           AdvertisementFile = "Ads.xml"
           Target="_newwwindow"
           OnAdCreated="AdCreated_Event"/>
 
   </form>
 
</body>
</html>

Nell'esempio di codice seguente viene illustrato come formattare il file XML contenente le informazioni sull'annuncio pubblicitario. Per altre informazioni sul file XML, vedere la AdvertisementFile proprietà della AdRotator classe .

<Advertisements>  
 <Ad>  
 <ImageUrl>image1.jpg</ImageUrl>  
 <NavigateUrl>http://www.microsoft.com</NavigateUrl>  
 <AlternateText>Microsoft Main Site</AlternateText>  
 <Impressions>80</Impressions>  
 <Keyword>Topic1</Keyword>  
 <Caption>This is the caption for Ad#1</Caption>   
 </Ad>  
 <Ad>  
 <ImageUrl>image2.jpg</ImageUrl>  
 <NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>  
 <AlternateText>Wingtip Toys</AlternateText>  
 <Impressions>80</Impressions>  
 <Keyword>Topic2</Keyword>  
 <Caption>This is the caption for Ad#2</Caption>   
 </Ad>  
</Advertisements>  

Commenti

Utilizzare la AlternateText 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 per l'annuncio.

Un file XML separato contiene le proprietà per l'annuncio visualizzato. Il AdRotator controllo imposta automaticamente la AlternateText proprietà con la voce di testo alternativa corrispondente nel file XML. Questa proprietà può essere utilizzata anche per impostare a livello di codice il testo alternativo.

Si applica a

Vedi anche