System.Web.UI.WebControls Namespace AdRotator Class
Sets or retrieves the filter used for selecting matching records in the advertisement file.
Inline |
<asp:adrotator keywordfilter = strKeyword ... > |
Script |
AdRotator.KeywordFilter [ = strKeyword ] |
strKeyword |
String specifying the keyword used to filter the XML advertisement file. |
The property is read/write with no default value.
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.
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
AdRotator Members