Web >> Development >> ASP.Net >> Web Controls >>  How to use an AdRotator control

<script runat="server"> Sub change_url(sender As Object, e As AdCreatedEventArgs) e.NavigateUrl="http://www.w3schools.com" End Sub </script> <body> <form runat="server"> <asp:AdRotator AdvertisementFile="Ad1.xml" runat="server" OnAdCreated="change_url" target="_blank" /> </form> <p><a href="ad1.xml" target="_blank">View XML file</a></p> </body> </html> where ad1.xml contains:- - <Advertisements> - <Ad> <ImageUrl>/banners/w6.gif</ImageUrl> <NavigateUrl>http://www.w3schools.com</NavigateUrl> <AlternateText>W3Schools Main Site</AlternateText> <Impressions>50</Impressions> <Keyword>elearning</Keyword> </Ad> - <Ad> <ImageUrl>/banners/rd_xhtml.jpg</ImageUrl> <NavigateUrl>http://www.w3schools.com/xhtml/default.asp</NavigateUrl> <AlternateText>XHTML Tutorial</AlternateText> <Impressions>50</Impressions> <Keyword>XHTML</Keyword> </Ad> </Advertisements>