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

Dim instance As AdCreatedEventArgs Dim value As String value = instance.ImageUrl instance.ImageUrl = value
/** @property */ public String get_ImageUrl () /** @property */ public void set_ImageUrl (String value)
AdRotator コントロールに表示するイメージの URL。既定値は String.Empty です。

ImageUrl プロパティを使用して、AdRotator コントロールの広告に表示するイメージの URL を指定します。相対 URL または絶対 URL を使用できます。相対 URL は、サーバー上の完全パスを指定せずに、イメージの位置を Web ページまたはユーザー コントロールの位置と関連付けます。このパスは、Web ページの位置に対する相対パスです。これにより、コード内でイメージのパスを更新しなくても、サーバー上の別のディレクトリにサイト全体を簡単に移動できます。絶対 URL では完全パスを指定するため、サイトを他のディレクトリに移動する場合は、コードを更新する必要があります。
各 XML ファイルには、表示される広告のプロパティが含まれています。AdRotator コントロールは、ImageUrl プロパティを、広告情報を格納している XML ファイルの対応するイメージ URL エントリに自動的に設定します。このプロパティは、イメージの URL をプログラムによって設定するときにも使用できます。
![]() |
---|
広告ファイルを使用して、このプロパティの相対 URL を指定すると、URL は、広告ファイルがあるディレクトリに対する相対 URL になります。広告ファイルを使用せずに、このプロパティを相対 URL で直接設定すると、URL は、AdRotator コントロールを含むページまたはユーザー コントロールのディレクトリに対する相対 URL になります。 |

ImageUrl プロパティをプログラムによって設定する方法を次のコード例に示します。
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script runat="server"> Sub AdCreated_Event(sender As Object, e As AdCreatedEventArgs) e.ImageUrl = "images/newimage.jpg" End Sub </script> </head> <body> <form runat="server"> <h3>AdCreatedEventArgs ImageUrl Example</h3> <asp:AdRotator id="AdRotator1" runat="server" AdvertisementFile = "Ads.xml" Target="_newwwindow" OnAdCreated="AdCreated_Event"/> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script runat="server"> void AdCreated_Event(Object sender, AdCreatedEventArgs e) { e.ImageUrl = "images/newimage.jpg"; } </script> </head> <body> <form runat="server"> <h3>AdCreatedEventArgs ImageUrl Example</h3> <asp:AdRotator id="AdRotator1" runat="server" AdvertisementFile = "Ads.xml" Target="_newwwindow" OnAdCreated="AdCreated_Event"/> </form> </body> </html>
<%@ Page Language="JScript" AutoEventWireup="True" %> <html> <head> <script runat="server"> function AdCreated_Event(sender : Object, e : AdCreatedEventArgs) { e.ImageUrl = "images/newimage.jpg"; } </script> </head> <body> <form runat="server"> <h3>AdCreatedEventArgs ImageUrl Example</h3> <asp:AdRotator id="AdRotator1" runat="server" AdvertisementFile = "Ads.xml" Target="_newwwindow" OnAdCreated="AdCreated_Event"/> </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>

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.ImageUrl プロパティを検索する場合は、下記のリンクをクリックしてください。

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