AdCreatedEventArgs::AdProperties Property
Gets a System.Collections::IDictionary object that contains all the advertisement properties for the currently displayed advertisement.
Assembly: System.Web (in System.Web.dll)
Property Value
Type: System.Collections::IDictionaryA 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>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.