Change Picture In AdRotator without refreshing page.

Step 1> create a new website project and add a folder with named image and add 3 images in that.


 step 2> add a XML file with named as AdRotatorFiles.xml and write as given ..

<?xml version="1.0" encoding="utf-8" ?> 

<Advertisements>
<Ad>
<ImageUrl>~/images/1.jpg</ImageUrl>
<NavigateUrl>http://www.varanasiworld.com/</NavigateUrl>
<AlternateText>ASP.NET Logo</AlternateText>
<Keyword>A</Keyword>
<Impressions>Web Site</Impressions>
<Caption>This is the caption for Ad#1</Caption> 

</Ad>
<Ad>
<ImageUrl>~/images/2.jpg</ImageUrl>
<NavigateUrl>http://www.varanasiworld.com/</NavigateUrl>
<AlternateText>teesting test</AlternateText>
<Keyword>S</Keyword>
<Impressions>Web Site</Impressions>
<Caption>This is the caption for Ad#2</Caption> 
</Ad>
<Ad>
<ImageUrl>~/images/3.jpg</ImageUrl>
<NavigateUrl>http://www.varanasiworld.com/</NavigateUrl>
<AlternateText>www.neostream.net</AlternateText>
<Keyword>S</Keyword>
<Impressions>Web Site</Impressions>
<Caption>This is the caption for Ad#3</Caption> 
</Ad>
</Advertisements>


Step 3> Add A default.aspx page, add script manager+update panel +timer control and a adrotator control in given manner.


<div>
    <asp:ScriptManager ID="ScriptManager1" runat="server" />

        
    
    <asp:UpdatePanel ID="up1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
        <ContentTemplate>
        <asp:Timer ID="Timer1" Interval="4000" runat="server" />
           <asp:AdRotator ID="AdRotator1" runat="server" 
            AdvertisementFile="~/AdRotatorFiles.xml" Height="200px" Target="_top" 
            Width="300px" />
        </ContentTemplate>
    </asp:UpdatePanel>  
    </div>

Now Run the site..it will start rotating your images without refresh your page.

I am attaching a code in rar format...you can download it also.
Ebook Download
View all
Learn
View all