asp.net.ph

AdRotator.KeywordFilter Property

System.Web.UI.WebControls Namespace   AdRotator Class


Sets or retrieves the filter used for selecting matching records in the advertisement file.

Syntax


Inline <asp:adrotator keywordfilter = strKeyword ... >
Script AdRotator.KeywordFilter [ = strKeyword ]

Property Value


strKeyword String specifying the keyword used to filter the XML advertisement file.

The property is read/write with no default value.

Remarks

Use the KeywordFilter property to search for entries in the advertisements file whose Keyword value matches the given filter. Only advertisements containing the keyword will be included for rotation in the AdRotator control.

Each advertisement in the XML advertisement file can be assigned a Keyword, which serves to categorize or group related advertisements.

<Advertisements>

   <Ad>
      <ImageUrl>image1.jpg</ImageUrl>
      <NavigateUrl>http://www.site1.com</NavigateUrl>
      <Keyword>Category1</Keyword>
   </Ad>

   <Ad>
      <ImageUrl>image2.jpg</ImageUrl>
      <NavigateUrl>http://www.site2.com</NavigateUrl>
      <Keyword>Category2</Keyword>
   </Ad>

</Advertisements>

It is not possible, though, to declare multiple keywords for any single advertisement, nor is it possible to specify more than one keyword when setting the KeywordFilter property.

CAUTION: If this property is set, but no keyword match exists in the advertisement file, a blank image is displayed and a trace warning is generated.

Example

The following example shows how to declaratively set the KeywordFilter property at design time.

<asp:adrotator id = "myAds" runat = "server" target = "_blank"
   keywordfilter = "csharp"
   advertisementfile = "myAds.xml" />

The following example demonstrates how to programmatically set the KeywordFilter to display only advertisements belonging to a certain category, based on user input.

 Show me 

See Also

AdRotator Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph