asp:adrotator and its xml (VB.net)
<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<script runat=server>
Sub AdCreated_Event(ByVal Sender as Object, _
ByVal E as AdCreatedEventArgs)
lblMessage.Text = "Here is information on the ad " _
& "currently being displayed:<BR>" _
& "<BR>Alternate Text: " & E.AlternateText _
& "<BR>Image URL: " & E.ImageURL _
& "<BR>Navigate URL: " & E.NavigateURL _
& "<BR>Account Name: " _
& E.AdProperties("AccountName").ToString()
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>AdRotator Control Sample Page</TITLE>
</HEAD>
<BODY >
<form runat="server">
<Font Face="Tahoma">
<asp:adrotator
AdvertisementFile="bannerads.xml"
KeywordFilter="ShowMe"
Target="_blank"
OnAdCreated="AdCreated_Event"
BorderColor="blue"
BorderWidth=3
runat="server"
/>
<BR><BR>
<asp:Label
id="lblMessage"
runat="server"
/>
</Font>
</Form>
</BODY>
</HTML>
<%-- bannerads.xml
<Advertisements>
<Ad>
<ImageUrl>./SampleBanner.gif</ImageUrl>
<NavigateUrl>http://www.google.com</NavigateUrl>
<AlternateText>Cick me now!</AlternateText>
<Keyword>ShowMe</Keyword>
<Impressions>71</Impressions>
<AccountName>BLR</AccountName>
</Ad>
<Ad>
<ImageUrl>./AnotherSample.gif</ImageUrl>
<NavigateUrl>http://www.java2s.com</NavigateUrl>
<AlternateText>Go to java2s Site</AlternateText>
<Keyword>ShowMe</Keyword>
<Impressions>70</Impressions>
<AccountName>TVB</AccountName>
</Ad>
<Ad>
<ImageUrl>./DoesNotExist.gif</ImageUrl>
<NavigateUrl>http://www.java2s.com</NavigateUrl>
<AlternateText>Won't see me</AlternateText>
<Keyword>DoNotShowMe</Keyword>
<Impressions>2000</Impressions>
<AccountName>SRQ</AccountName>
</Ad>
</Advertisements>
--%>
Related examples in the same category