Search
Author
ASP.NET Tutorials
Author
Sheo Narayan
Advertisements


Winners

Win Prizes

Social Presence
Like us on Facebook

Silverlight Tutorials | Report a Bug in the Tutorial
asp:AdRotator control
AdRotator control displays an image and updates both Image and target URL each time the page refreshes.
 
AdRotator control displays an image and updates both Image and target URL each time the page refreshes. When user clicks on the image, he/she is redirected to the target URL.

Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <img>.
Generally, AdRotator control is used to show the advertisement banner on the page. The source of advertisements banners are written in a XML file in a certain format.

Following are some important properties that are very useful.
AdvertisementFile Location of the XML file that contains the image, target URL, and other details.
ImageUrl Url of image location.
AlternetText Appears if image not loaded properly
NavigateUrl The target link that will open when user clicks the image.
Impression A number that sets how often an advertisement banner will appear. This number is relative to numbers specified for other ads. eg. a banner with impression 60 will be shown twice as the banner with 30.
KeywordFilter Gets or sets a keyword to filter for a specific type of advertisements.
DEMO : AdRotator Show Source Code
Go to ListBox tutorials  
        // AdRotator contrl 
        <asp:AdRotator ID="AdRotator2" runat="Server" AdvertisementFile="~/tutorials/controls/controldata/adRotator.xml"
         ImageUrlField="ImageUrl" NavigateUrlField="NavigateUrl" AlternateTextField="AlternateText"
          BorderWidth="1" BorderColor="blue" />         
          
          // Advertisement File
          <Advertisements>
          <Ad>
            <ImageUrl>~/images/samples/DotNetLogo.gif</ImageUrl>
            <NavigateUrl>~/tutorials/controls/listbox.aspx</NavigateUrl>
            <AlternateText>Go to ListBox tutorials</AlternateText>
            <Impression>30</Impression>
          </Ad>
          <Ad>
            <ImageUrl>~/images/samples/NewAdvance.gif</ImageUrl>
            <NavigateUrl>~/tutorials/controls/button.aspx</NavigateUrl>
            <AlternateText>Go to Button tutorials</AlternateText>
            <Impression>15</Impression>
          </Ad>
          <Ad>
            <ImageUrl>~/images/samples/DotNetFunda3.gif</ImageUrl>
            <NavigateUrl>~/tutorials/controls/label.aspx</NavigateUrl>
            <AlternateText>Go to Label tutorials</AlternateText>
            <Impression>15</Impression>
          </Ad>
          <Ad>
            <ImageUrl>~/images/samples/DotNetFunda2.gif</ImageUrl>
            <NavigateUrl>~/tutorials/controls/calendar.aspx</NavigateUrl>
            <AlternateText>Go to Calendar control tutorials</AlternateText>
            <Impression>40</Impression>
          </Ad>
        </Advertisements>