AdCreatedEventArgs クラス
アセンブリ: System.Web (system.web.dll 内)


AdRotator コントロールによってページに広告が表示されると AdCreated イベントが発生します。
AdCreatedEventArgs のインスタンスの初期プロパティ値の一覧については、AdCreatedEventArgs コンストラクタのトピックを参照してください。
イベント処理の詳細については、「イベントとデリゲート」を参照してください。
Topic | Location |
---|---|
方法 : AdRotator Web サーバー コントロールでプログラムによって広告を選択する | ASP .NET Web アプリケーションの作成 |

AdCreated イベントのハンドラを指定およびコーディングする方法を次のコード例に示します。この例では AdRotator コントロールが作成されたときに広告に関連付けられた URL を取得して、次にその URL を表示します。この例では、例の中でリストされている XML ファイル (Ads.xml) が必要です。
<%@ 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.NavigateUrl End Sub </script> <body> <form runat="server"> <h3>AdRotator Example</h3> <asp:AdRotator id="test1" runat="server" AdvertisementFile = "~/App_Data/Ads.xml" Borderwidth="1" Target="_blank" 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=e.NavigateUrl; } </script> <body> <form runat="server"> <h3>AdRotator Example</h3> <asp:AdRotator id="test1" runat="server" AdvertisementFile = "~/App_Data/Ads.xml" Borderwidth="1" Target="_blank" 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=e.NavigateUrl; } </script> <body> <form runat="server"> <h3>AdRotator Example</h3> <asp:AdRotator id="test1" runat="server" AdvertisementFile = "~/App_Data/Ads.xml" Borderwidth="1" Target="_blank" OnAdCreated="AdCreated_Event"/><br><br> <asp:label id="Message" runat="server"/> </form> </body> </html>
広告情報を含む 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>
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> </head> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) ' Create an EventHandler delegate for the method you want to handle the event ' and then add it to the list of methods called when the event is raised. AddHandler Ad.AdCreated, AddressOf AdCreated_Event End Sub Sub AdCreated_Event(sender As Object, e As AdCreatedEventArgs) ' Override the AlternateText value from the ads.xml file. e.AlternateText = "Visit this site!" End Sub </script> <body> <form runat="server"> <h3>AdRotator AdCreated Example</h3> Notice that the AlternateText property of the advertisement <br> has been programmatically modified from the value in the XML <br> file. <br><br> <asp:AdRotator id="Ad" runat="server" AdvertisementFile = "~/App_Data/Ads.xml" Borderwidth="1" Target="_blank"/> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> </head> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // Create an EventHandler delegate for the method you want to handle the event // and then add it to the list of methods called when the event is raised. Ad.AdCreated += new System.Web.UI.WebControls.AdCreatedEventHandler(this.AdCreated_Event); } void AdCreated_Event(Object sender, AdCreatedEventArgs e) { // Override the AlternateText value from the ads.xml file. e.AlternateText = "Visit this site!"; } </script> <body> <form runat="server"> <h3>AdRotator AdCreated Example</h3> Notice that the AlternateText property of the advertisement <br> has been programmatically modified from the value in the XML <br> file. <br><br> <asp:AdRotator id="Ad" runat="server" AdvertisementFile = "~/App_Data/Ads.xmla" Borderwidth="1" Target="_blank"/> </form> </body> </html>

System.EventArgs
System.Web.UI.WebControls.AdCreatedEventArgs


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


AdCreatedEventArgs コンストラクタ
アセンブリ: System.Web (system.web.dll 内)


このコンストラクタを使用して、AdCreatedEventArgs クラスの新しいインスタンスを作成し、初期化します。
AdCreatedEventArgs のインスタンスの初期プロパティ値を次の表に示します。
AdProperties | adProperties パラメータが null 参照 (Visual Basic では Nothing) でない場合は、adProperties パラメータの値。それ以外の場合は、空の System.Collections.IDictionary。 |
AlternateText | adProperties パラメータが null 参照 (Visual Basic では Nothing) でない場合は、代替テキストを示す adProperties パラメータの値。それ以外の場合は String.Empty。 |
ImageUrl | adProperties パラメータが null 参照 (Visual Basic では Nothing) でない場合は、表示するイメージの URL を示す adProperties パラメータの値。それ以外の場合は String.Empty。 |
NavigateUrl | adProperties パラメータが null 参照 (Visual Basic では Nothing) でない場合は、移動先の URL を示す adProperties パラメータの値。それ以外の場合は String.Empty。 |

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


AdCreatedEventArgs プロパティ

名前 | 説明 | |
---|---|---|
![]() | AdProperties | 現在表示されている広告のすべての広告プロパティが格納されている System.Collections.IDictionary オブジェクトを取得します。 |
![]() | AlternateText | 広告イメージが使用できない場合に AdRotator コントロールに表示される代替テキストを取得または設定します。ツール ヒント機能をサポートしているブラウザの場合、このテキストは広告のツール ヒントとして表示されます。 |
![]() | ImageUrl | AdRotator コントロールに表示するイメージの URL を取得または設定します。 |
![]() | NavigateUrl | AdRotator コントロールがクリックされたときに表示される Web ページを取得または設定します。 |

AdCreatedEventArgs メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

AdCreatedEventArgs メンバ
AdRotator コントロールの AdCreated イベントのデータを提供します。このクラスは継承できません。
AdCreatedEventArgs データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | AdProperties | 現在表示されている広告のすべての広告プロパティが格納されている System.Collections.IDictionary オブジェクトを取得します。 |
![]() | AlternateText | 広告イメージが使用できない場合に AdRotator コントロールに表示される代替テキストを取得または設定します。ツール ヒント機能をサポートしているブラウザの場合、このテキストは広告のツール ヒントとして表示されます。 |
![]() | ImageUrl | AdRotator コントロールに表示するイメージの URL を取得または設定します。 |
![]() | NavigateUrl | AdRotator コントロールがクリックされたときに表示される Web ページを取得または設定します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- AdCreatedEventArgsのページへのリンク