AdRotator.OnAdCreated メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > AdRotator.OnAdCreated メソッドの意味・解説 

AdRotator.OnAdCreated メソッド

AdRotator コントロールの AdCreated イベント発生させます。このメソッドには、本来、Web フォーム コントロールと同じ機能備わってます。詳細については、「System.Web.UI.WebControls.AdRotator.」を参照してください

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

Protected Overridable Sub
 OnAdCreated ( _
    e As AdCreatedEventArgs _
)
Dim e As AdCreatedEventArgs

Me.OnAdCreated(e)
protected virtual void OnAdCreated (
    AdCreatedEventArgs e
)
protected:
virtual void OnAdCreated (
    AdCreatedEventArgs^ e
)
protected void OnAdCreated (
    AdCreatedEventArgs e
)
protected function OnAdCreated (
    e : AdCreatedEventArgs
)

パラメータ

e

イベント データ格納している AdCreatedEventArgs オブジェクト

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AdRotator クラス
AdRotator メンバ
System.Web.UI.MobileControls 名前空間
System.Web.UI.WebControls.AdRotator
その他の技術情報
AdRotator コントロール概要

AdRotator.OnAdCreated メソッド

AdRotator コントロールの AdCreated イベント発生させます

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Overridable Sub
 OnAdCreated ( _
    e As AdCreatedEventArgs _
)
Dim e As AdCreatedEventArgs

Me.OnAdCreated(e)
protected virtual void OnAdCreated (
    AdCreatedEventArgs e
)
protected:
virtual void OnAdCreated (
    AdCreatedEventArgs^ e
)
protected void OnAdCreated (
    AdCreatedEventArgs e
)
protected function OnAdCreated (
    e : AdCreatedEventArgs
)

パラメータ

e

イベント データ格納している AdCreatedEventArgs。

解説解説
使用例使用例

AdCreated イベントハンドラ指定およびコーディングする方法次のコード例示します。この例では、AdRotator コントロール作成されたときに広告関連付けられた URL取得して次にその URL表示します

<%@ 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 ファイル詳細については、AdvertisementFile プロパティトピック参照してください

<Advertisements>
  <Ad>
    <ImageUrl>~/Images/image1.jpg</ImageUrl>
    <Height>60</Height>
    <Width>190</Width>
    <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>~/Images/image2.jpg</ImageUrl>
    <Height>90</Height>
    <Width>90</Width>
    <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>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

AdRotator.OnAdCreated メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



AdRotator.OnAdCreated メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS