AdRotator.KeywordFilter Property

Gets or sets a category keyword to filter for specific types of advertisements in the XML advertisement file.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

[BindableAttribute(true)] 
public:
property String^ KeywordFilter {
	String^ get ();
	void set (String^ value);
}
/** @property */
public String get_KeywordFilter ()

/** @property */
public void set_KeywordFilter (String value)

public function get KeywordFilter () : String

public function set KeywordFilter (value : String)

Property Value

The keyword to filter for specific types of advertisements in the XML advertisement file. The default value is an empty string ("").

Each advertisement in the XML advertisement file can be assigned a category keyword. Use the KeywordFilter property to filter the advertisements for the specified keyword. Only advertisements containing the keyword will be selected for the AdRotator control. The KeywordFilter property can be programmatically set to match the profile of the user.

The KeywordFilter property is a very simple filter that searches for the specified keyword. 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.

NoteNote

The AdvertisementFile property needs to be set for this property to have any effect.

Caution noteCaution

If the specified keyword is not found in the XML advertisement file, no advertisement is displayed in the AdRotator control. Be sure to specify a keyword for this property with at least one match in the advertisement file.

The following code example demonstrates how to use the KeywordFilter property to filter for game-related advertisements.

No code example is currently available or this language may not be supported.

The following code example demonstrates how to specify a keyword for each advertisement in the XML advertisement file. 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>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: