AdCreatedEventArgs.AdProperties Property
Assembly: System.Web (in system.web.dll)
/** @property */ public IDictionary get_AdProperties ()
public function get AdProperties () : IDictionary
Not applicable.
Property Value
A System.Collections.IDictionary that contains a list of advertisement properties for the currently displayed advertisement. The default value is String.Empty.Use the AdProperties property to get a System.Collections.IDictionary object that contains the advertisement properties for the currently displayed advertisement. The keys and values of the System.Collections.IDictionary object are of type System.String.
The AdRotator control randomly selects an advertisement each time the control is displayed on the Web page. The attributes for the selected advertisement are extracted from the advertisement XML file and stored in a System.Collections.IDictionary object. When the AdRotator control creates a new instance of the AdCreatedEventArgs class, the AdProperties property gets initialized with the System.Collections.IDictionary object.
Custom attributes about an advertisement, such as an advertisement caption, can also be included in the advertisement XML file. Use this property in the OnAdCreated event handler to get the custom attributes.
The following code example demonstrates how to use the AdProperties property in the OnAdCreated event handler to provide a custom caption.
<Advertisements>
<Ad>
<ImageUrl>image1.jpg</ImageUrl>
<NavigateUrl>http://www.microsoft.com</NavigateUrl>
<AlternateText>Microsoft Main Site</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic1</Keyword>
<Caption>This is the caption for Ad#1</Caption>
</Ad>
<Ad>
<ImageUrl>image2.jpg</ImageUrl>
<NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>
<AlternateText>Wing Tip Toys</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic2</Keyword>
<Caption>This is the caption for Ad#2</Caption>
</Ad>
</Advertisements>
The following code example demonstrates how to include custom attributes about an advertisement in the advertisement XML file. For more information on the XML file, see the AdvertisementFile property of the AdRotator class.
<Advertisements> <Ad> <ImageUrl>image1.jpg</ImageUrl> <NavigateUrl>http://www.microsoft.com</NavigateUrl> <AlternateText>Microsoft Main Site</AlternateText> <Impressions>80</Impressions> <Keyword>Topic1</Keyword> <Caption>This is the caption for Ad#1</Caption> </Ad> <Ad> <ImageUrl>image2.jpg</ImageUrl> <NavigateUrl>http://www.wingtiptoys.com</NavigateUrl> <AlternateText>Wingtip Toys</AlternateText> <Impressions>80</Impressions> <Keyword>Topic2</Keyword> <Caption>This is the caption for Ad#2</Caption> </Ad> </Advertisements>