AdRotator.AlternateTextField Propriedade

Definição

Obtém ou define um campo de dados personalizado a usar em vez do atributo AlternateText para um anúncio.Gets or sets a custom data field to use in place of the AlternateText attribute for an advertisement.

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

Valor da propriedade

String

O nome que identifica o campo em que o texto alternativo de um anúncio é armazenado.The name that identifies the field where the alternate text for an advertisement is stored. O valor padrão é "AlternateText".The default value is "AlternateText."

Exemplos

O exemplo de código a seguir demonstra AlternateTextField como usar a propriedade para especificar um campo de dados personalizado.The following code example demonstrates using the AlternateTextField property to specify a custom data field. As NavigateUrlField ImageUrlField Propriedades,, e AlternateTextField são usadas para selecionar dinamicamente um campo personalizado a ser usado no lugar dos NavigateUrl atributos, ImageUrl e AlternateText .The NavigateUrlField, ImageUrlField, and AlternateTextField properties are used to dynamically select a custom field to use in place of the NavigateUrl, ImageUrl, and AlternateText attributes. Este exemplo usa um filtro de dispositivo para indicar que os campos personalizados devem ser usados para dispositivos habilitados para WAP (protocolo de aplicativo sem fio).This example uses a device filter to indicate that custom fields should be used for Wireless Application Protocol (WAP)-enabled devices.

<%@ 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 runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
    <p>This example demonstrates using the AdRotator control.</p>
    <p>
      <asp:AdRotator ID="AdRotator1" Runat="server" 
        DataSourceID="Ads"
        Winwap:NavigateUrlField="WMLNavigateUrl"
        Winwap:ImageUrlField="WmlImageUrl"
        Winwap:AlternateTextField="WmlAlternateText"
      />
      <asp:XmlDataSource ID="Ads" 
        Runat="server" 
        DataFile="~/App_Data/AdvertisementList.xml">
      </asp:XmlDataSource>
    </p>
  </div>
  </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 runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
    <p>This example demonstrates using the AdRotator control.</p>
    <p>
      <asp:AdRotator ID="AdRotator1" Runat="server" 
        DataSourceID="Ads"
        Winwap:NavigateUrlField="WMLNavigateUrl"
        Winwap:ImageUrlField="WmlImageUrl"
        Winwap:AlternateTextField="WmlAlternateText"
      />
      <asp:XmlDataSource ID="Ads" 
        Runat="server" 
        DataFile="~/App_Data/AdvertisementList.xml">
      </asp:XmlDataSource>
    </p>
  </div>
  </form>
</body>
</html>

Veja a seguir os dados XML de exemplo para o exemplo anterior.The following is the sample XML data for the previous example.

<Advertisements>  
  <Ad>  
    <ImageUrl>~/Images/ad1.gif</ImageUrl>  
    <NavigateUrl>https://docs.microsoft.com/dotnet/visual-basic/</NavigateUrl>  
    <AlternateText>Visual Basic documentation</AlternateText>  
    <Width>140</Width>  
    <Height>100</Height>  
    <!-- The following custom elements will be used by WAP-enabled  
      devices. -->  
    <WmlImageUrl>~/Images/mobileAd1.jpg</WmlImageUrl>  
    <WmlNavigateUrl>https://msdn.microsoft.com/mobile/</WmlNavigateUrl>  
    <WmlAlternateText>Windows Mobile Developer Site</WmlAlternateText>  
  </Ad>  
  <Ad>  
    <ImageUrl>~/Images/ad2.gif</ImageUrl>  
    <NavigateUrl>https://docs.microsoft.com/</NavigateUrl>  
    <AlternateText>Docs</AlternateText>  
    <Width>150</Width>  
    <Height>150</Height>  
    <!-- The following custom elements will be used by WAP-enabled  
      devices. -->  
    <WmlImageUrl>~/Images/mobileAd2.jpg</WmlImageUrl>  
    <WmlNavigateUrl>https://msdn.microsoft.com/mobilibity/</WmlNavigateUrl>  
    <WmlAlternateText>Windows Mobile Developer Site</WmlAlternateText>  
  </Ad>  
</Advertisements>  

Comentários

A AlternateTextField propriedade é usada para selecionar um campo de dados personalizado a ser usado no lugar do AlternateText atributo para um anúncio.The AlternateTextField property is used to select a custom data field to use in place of the AlternateText attribute for an advertisement. Como AlternateText , esse campo personalizado é definido no arquivo XML que contém informações de anúncio.Like AlternateText, this custom field is defined in the XML file that contains advertisement information.

Aplica-se a

Confira também