AdRotator.KeywordFilter Propriedade

Definição

Obtém ou define uma palavra-chave de categoria para filtrar tipos específicos de anúncios no arquivo XML de anúncio.Gets or sets a category keyword to filter for specific types of advertisements in the XML advertisement file.

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

Valor da propriedade

String

A palavra-chave para filtrar tipos específicos de anúncios no arquivo de anúncio XML.The keyword to filter for specific types of advertisements in the XML advertisement file. O valor padrão é uma cadeia de caracteres vazia ("").The default value is an empty string ("").

Atributos

Exemplos

O exemplo de código a seguir demonstra como usar a KeywordFilter propriedade para filtrar anúncios relacionados a jogos.The following code example demonstrates how to use the KeywordFilter property to filter for game-related advertisements.

<%@ 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>AdRotator Example</title>
</head>
 
 <body>
    <form id="form1" runat="server">
 
       <h3>AdRotator Example</h3>
 
       <asp:AdRotator id="AdRotator1" runat="server"
            Target="_self"
            KeywordFilter="Games"
            AdvertisementFile="~/App_Data/Ads.xml"/>
 
    </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>AdRotator Example</title>
</head>
 
 <body>
    <form id="form1" runat="server">
 
       <h3>AdRotator Example</h3>
 
       <asp:AdRotator id="AdRotator1" runat="server"
            Target="_self"
            KeywordFilter="Games"
            AdvertisementFile="~/App_Data/Ads.xml"/>
 
    </form>
 </body>
 
 </html>

O exemplo de código a seguir demonstra como especificar uma palavra-chave para cada anúncio no arquivo de anúncio XML.The following code example demonstrates how to specify a keyword for each advertisement in the XML advertisement file. Para obter mais informações sobre o formato de arquivo, consulte o AdvertisementFile membro.For more information on the file format, see the AdvertisementFile member.

<Advertisements>  
  <Ad>  
    <ImageUrl>~/Images/image1.jpg</ImageUrl>  
    <Height>60</Height>  
    <Width>190</Width>  
    <NavigateUrl>http://www.microsoft.com</NavigateUrl>  
    <AlternateText>Microsoft Main Site</AlternateText>  
    <Impressions>80</Impressions>  
    <Keyword>Business</Keyword>  
    <Caption>This is the caption for Ad#1</Caption>   
  </Ad>  
  <Ad>  
    <ImageUrl>~/Images/image2.jpg</ImageUrl>  
    <Height>90</Height>  
    <Width>90</Width>  
    <NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>  
    <AlternateText>Wingtip Toys</AlternateText>  
    <Impressions>80</Impressions>  
    <Keyword>Games</Keyword>  
    <Caption>This is the caption for Ad#2</Caption>   
  </Ad>  
</Advertisements>  

Comentários

Cada anúncio no arquivo de anúncio XML pode ser atribuído a uma palavra-chave Category.Each advertisement in the XML advertisement file can be assigned a category keyword. Use a KeywordFilter propriedade para filtrar os anúncios para a palavra-chave especificada.Use the KeywordFilter property to filter the advertisements for the specified keyword. Somente os anúncios que contêm a palavra-chave serão selecionados para o AdRotator controle.Only advertisements containing the keyword will be selected for the AdRotator control. A KeywordFilter propriedade pode ser definida de forma programática para corresponder ao perfil do usuário.The KeywordFilter property can be programmatically set to match the profile of the user.

A KeywordFilter propriedade é um filtro muito simples que pesquisa a palavra-chave especificada.The KeywordFilter property is a very simple filter that searches for the specified keyword. Não é possível especificar mais de uma palavra-chave na KeywordFilter propriedade, nem é possível declarar várias palavras-chaves no arquivo de anúncio.It is not possible to specify more than one keyword in the KeywordFilter property, nor is it possible to declare multiple keywords in the advertisement file.

Observação

A AdvertisementFile propriedade precisa ser definida para que essa propriedade tenha qualquer efeito.The AdvertisementFile property needs to be set for this property to have any effect.

Cuidado

Se a palavra-chave especificada não for encontrada no arquivo de anúncio XML, nenhum anúncio será exibido no AdRotator controle.If the specified keyword is not found in the XML advertisement file, no advertisement is displayed in the AdRotator control. Certifique-se de especificar uma palavra-chave para essa propriedade com pelo menos uma correspondência no arquivo de anúncio.Be sure to specify a keyword for this property with at least one match in the advertisement file.

Aplica-se a

Confira também