AdRotator.OnAdCreated Method

Raises the AdCreated event for the AdRotator control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

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

Parameters

e

An AdCreatedEventArgs that contains event data.

The AdCreated event is raised on the server after the AdRotator control is created, but before the page is rendered. If the AdvertisementFile property is set, the AdCreated event is raised after an advertisement has been selected by the AdRotator control.

Raising an event invokes the event-handling method through a delegate. For more information, see How to: Consume Events in a Web Forms Application.

Notes to Inheritors: When overriding OnAdCreated in a derived class, be sure to call the base class's OnAdCreated method.

The following code example demonstrates how to specify and code a handler for the AdCreated event. It gets the URL associated with the advertisement when the AdRotator control is created and displays it below the control.

No code example is currently available or this language may not be supported.

The following code example demonstrates how to format the XML file that contains the advertisement information. For more information on the XML file, see the AdvertisementFile property.

<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>
No code example is currently available or this language may not be supported.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: