AdCreatedEventArgs.AdProperties プロパティ
アセンブリ: System.Web (system.web.dll 内)

現在表示されている広告の広告プロパティのリストが格納されている System.Collections.IDictionary。既定値は String.Empty です。

AdProperties プロパティを使用して、現在表示されている広告の広告プロパティが格納されている System.Collections.IDictionary オブジェクトを取得します。System.Collections.IDictionary オブジェクトのキーと値は、System.String 型です。
AdRotator コントロールは、コントロールが Web ページに表示されるたび、ランダムに広告を選択します。選択した広告の属性は広告 XML ファイルから抽出され、System.Collections.IDictionary オブジェクトに格納されます。AdRotator コントロールが AdCreatedEventArgs クラスの新しいインスタンスを作成すると、AdProperties プロパティは System.Collections.IDictionary オブジェクトを使用して初期化されます。
広告キャプションなど、広告のカスタム属性も広告 XML ファイルに含めることができます。カスタム属性を取得するには、OnAdCreated イベント ハンドラのプロパティを使用します。

OnAdCreated イベント ハンドラの AdProperties プロパティを使用して、カスタム キャプションを作成する方法を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> </head> <script language="VB" runat="server"> Sub AdCreated_Event(sender As Object, e As AdCreatedEventArgs) Message.Text = e.AdProperties("Caption") End Sub </script> <body> <form runat="server"> <h3>AdRotator Example</h3> <asp:AdRotator id="test1" runat="server" AdvertisementFile = "Ads.xml" Borderwidth="1" Target="_newwwindow" OnAdCreated="AdCreated_Event"/><br><br> <asp:label id="Message" runat="server"/> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> </head> <script language="C#" runat="server"> void AdCreated_Event(Object sender, AdCreatedEventArgs e) { Message.Text=(string)e.AdProperties["Caption"]; } </script> <body> <form runat="server"> <h3>AdRotator Example</h3> <asp:AdRotator id="test1" runat="server" AdvertisementFile = "Ads.xml" Borderwidth="1" Target="_newwwindow" OnAdCreated="AdCreated_Event"/><br><br> <asp:label id="Message" runat="server"/> </form> </body> </html>
<%@ Page Language="JScript" AutoEventWireup="True" %> <html> <head> </head> <script language="JScript" runat="server"> function AdCreated_Event(sender, e : AdCreatedEventArgs) { Message.Text=String(e.AdProperties["Caption"]); } </script> <body> <form runat="server"> <h3>AdRotator Example</h3> <asp:AdRotator id="test1" runat="server" AdvertisementFile = "Ads.xml" Borderwidth="1" Target="_newwwindow" OnAdCreated="AdCreated_Event"/><br><br> <asp:label id="Message" runat="server"/> </form> </body> </html>
<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>
広告のカスタム属性を広告 XML ファイルに含める方法を次のコード例に示します。XML ファイルの詳細については、AdRotator クラスの AdvertisementFile プロパティのトピックを参照してください。
<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 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からAdCreatedEventArgs.AdProperties プロパティを検索する場合は、下記のリンクをクリックしてください。

- AdCreatedEventArgs.AdProperties プロパティのページへのリンク