The AdRotator is a special control in ASP.NET that is used to display flashing banner ads The control is capable of displaying ads randomly or sequentially as set by the user. Each time the page is refreshed or reloaded a new ad can be displayed to the user. Also, we can assign priorities in such a way that certain ads are displayed frequently than others.
<asp:AdRotator ID="AdRotator2" runat="server" />
<?xml version="1.0" encoding="utf-8" ?>
<Impressions>: (Optional) The display rates in percent of the hits. The larger the number, the more often the ad is displayed.
<asp:AdRotator ID="AdRotator1" runat="server" DataSourceID="XmlDataSource1" OnAdCreated="AdRotator1_AdCreated" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XMLFile2.xml">
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.
How bind xml file in AdRotator
Click new Data Source
Select xml file and click ok.
Browse and select xml file and clik ok.
Run The Project
When Page will refresh next image will be displayed
When you click on the image then it will redirected to the specified page.