Source view of ADROTATOR.ASPX
DotNet Funda: Code Viewer
adrotator.aspx | adrotator.aspx.cs
Close Window  
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHeader" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderForTitleAndIntro" Runat="Server">
    <table width="100%" cellpadding="2" cellspacing="0">
        <tr valign="top" class="ArticleTitle">
            <td style="padding-left:10px;" valign="middle">
                asp:AdRotator control</td>
        </tr>
        <tr>
            <td class="ArticleContents">
                AdRotator control displays an image and updates both Image and target URL each time the page refreshes.
            </td>
        </tr>
        <tr>
            <td colspan="2">&nbsp;</td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderForContents" Runat="Server">
    <div class="ArticleContents">
        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.
        <p>
        Its properties like <span class="DemoCP">BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. </span>
        are implemented through style properites of &lt;img&gt;. <br />
        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.
        
        </p>
        Following are some important properties that are very useful.
        <table width="100%" class="TutoPropPlaceHolder" border="1" cellpadding="2" cellspacing="1">
            <tr>
                <td class="DemoCP">AdvertisementFile</td>
                <td>
                    Location of the XML file that contains the image, target URL, and other details.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">ImageUrl</td>
                <td>
                    Url of image location.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">AlternetText</td>
                <td>
                    Appears if image not loaded properly
                </td>
            </tr>
            <tr>
                <td class="DemoCP">NavigateUrl</td>
                <td>
                    The target link that will open when user clicks the image.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">Impression</td>
                <td>
                    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.
                </td>
            </tr>
            <tr>
                <td class="DemoCP">KeywordFilter</td>
                <td>
                    Gets or sets a keyword to filter for a specific type of advertisements.
                </td>
            </tr>
        </table>
        <!-- START - Demo Section -->
        <table class="DemoPlaceHolder" border="1" cellpadding="2" cellspacing="4">
            <tr>
                <td class="DemoTitle">
                    DEMO : AdRotator
                </td>
                <td align="right">
                    <a class="DemoShowSource" href="../../misc/codeviewer/default.aspx?pagename=~/tutorials/controls/adrotator.aspx" target="_blank">Show Source Code</a>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:AdRotator ID="AdRotator1" runat="Server" AdvertisementFile="~/tutorials/controls/controldata/adRotator.xml"
                     
                      BorderWidth="1" BorderColor="blue" />
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <!-- START - Server Side Code -->
                    <pre>
        // AdRotator contrl 
        &lt;asp:AdRotator ID="AdRotator2" runat="Server" AdvertisementFile="~/tutorials/controls/controldata/adRotator.xml"
         ImageUrlField="ImageUrl" NavigateUrlField="NavigateUrl" AlternateTextField="AlternateText"
          BorderWidth="1" BorderColor="blue" /&gt;         
          
          // Advertisement File
          &lt;Advertisements&gt;
          &lt;Ad&gt;
            &lt;ImageUrl&gt;~/images/samples/DotNetLogo.gif&lt;/ImageUrl&gt;
            &lt;NavigateUrl&gt;~/tutorials/controls/listbox.aspx&lt;/NavigateUrl&gt;
            &lt;AlternateText&gt;Go to ListBox tutorials&lt;/AlternateText&gt;
            &lt;Impression&gt;30&lt;/Impression&gt;
          &lt;/Ad&gt;
          &lt;Ad&gt;
            &lt;ImageUrl&gt;~/images/samples/NewAdvance.gif&lt;/ImageUrl&gt;
            &lt;NavigateUrl&gt;~/tutorials/controls/button.aspx&lt;/NavigateUrl&gt;
            &lt;AlternateText&gt;Go to Button tutorials&lt;/AlternateText&gt;
            &lt;Impression&gt;15&lt;/Impression&gt;
          &lt;/Ad&gt;
          &lt;Ad&gt;
            &lt;ImageUrl&gt;~/images/samples/DotNetFunda3.gif&lt;/ImageUrl&gt;
            &lt;NavigateUrl&gt;~/tutorials/controls/label.aspx&lt;/NavigateUrl&gt;
            &lt;AlternateText&gt;Go to Label tutorials&lt;/AlternateText&gt;
            &lt;Impression&gt;15&lt;/Impression&gt;
          &lt;/Ad&gt;
          &lt;Ad&gt;
            &lt;ImageUrl&gt;~/images/samples/DotNetFunda2.gif&lt;/ImageUrl&gt;
            &lt;NavigateUrl&gt;~/tutorials/controls/calendar.aspx&lt;/NavigateUrl&gt;
            &lt;AlternateText&gt;Go to Calendar control tutorials&lt;/AlternateText&gt;
            &lt;Impression&gt;40&lt;/Impression&gt;
          &lt;/Ad&gt;
        &lt;/Advertisements&gt;           
                    </pre> 
                    <!-- END - Server Side Code -->
                </td>
            </tr>
        </table>
        <!-- END - Demo Section -->
        </div>
    <br />
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="PlaceHolderFooter" Runat="Server">
</asp:Content>

Go Top