Forums » .NET » ASP.NET »

Adrotator


Posted Date: 20 Apr 2009      Posted By:: brahmaji     Member Level: Bronze    Member Rank: 3313     Points: 1   Responses: 6



how to use adrotator in asp.net without refreshing the page
and with out using ajax
or
how to use adrotator in asp.net by refreshing the part of a page
and with out using ajax





Responses

#368367    Author: Praveen      Member Level: Gold      Member Rank: 69     Date: 20/Apr/2009   Rating: 2 out of 52 out of 5     Points: 2

http://www.codeproject.com/KB/webforms/AdRotator_VT.aspx

http://www.w3schools.com/asp/asp_adrotator.asp

hope that will help u


 
#368394    Author: D.Jeya kumar(JK)      Member Level: Gold      Member Rank: 13     Date: 20/Apr/2009   Rating: 2 out of 52 out of 5     Points: 2

Hi,


You can use java script to load the pages.but it is also has some restriction

Regards
JK

Thanks & Regards
D.Jeya Kumar(JK)


 
#368405    Author: archana      Member Level: Gold      Member Rank: 956     Date: 20/Apr/2009   Rating: 2 out of 52 out of 5     Points: 2

hi,



http://www.beansoftware.com/ASP.NET-Tutorials/Use-AdRotator-Control.aspx





 
#368409    Author: archana      Member Level: Gold      Member Rank: 956     Date: 20/Apr/2009   Rating: 2 out of 52 out of 5     Points: 2

hi,



http://www.experts-exchange.com/Microsoft/Development/Q_24117595.html


 
#368412    Author: Veeraraghavan Jeevanandam      Member Level: Gold      Member Rank: 0     Date: 20/Apr/2009   Rating: 2 out of 52 out of 5     Points: 2

Hi,

see the below given code part,

How to Rotate Ads without Refreshing the Page using AdRotator and ASP.NET AJAX

The AdRotator control in ASP.NET is extremely handy when it comes to randomly displaying advertisements on your site. However the ads are rotated only when the user refreshes the page. In this article, we will explore how you can easily rotate ads at regular intervals, without the user refreshing the page. Follow these steps:
Step 1: Open VS 2008. Click File > New > Website. Choose ASP.NET Website from the list of installed template, choose target platform as .NET Framework 3.5, choose the desired language and enter the location where you would like to store the website on your FileSystem. I have created a folder called VS2008 Projects, so the location over here is C:\VS 2008 Projects\AdRotatorAJAX. After typing the location, click OK.
Step 2: Now you would need to create some banners images to test out the adrotator functionality. I have designed three 270 * 270 banners (dnc.jpg, ssc.jpg and writeforus.jpg) that has been attached along with the code over here. Let us add them to our project. Right click the project > New Folder > Rename it to ‘images’. Now add the 3 banners images to this project.
Step 3: The AdRotator control can retrieve the list of advertisements from either a XML file or from the database. To keep things simple, I will be using an XML file. So the next step is to create the advertisement file. I prefer to create this file in the App_Data folder as it is secure. To do so, right click the App_Data folder > Add New Item > ‘XML File’ > Rename it to ads.xml and click Add. Now add the following contents to the ‘ads.xml’ file:
<?xmlversion="1.0"encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>~/images/dnc.jpg</ImageUrl>
<NavigateUrl>http://www.dotnetcurry.com</NavigateUrl>
<AlternateText>DotNetCurry Home Page</AlternateText>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/ssc.jpg</ImageUrl>
<NavigateUrl>http://www.sqlservercurry.com</NavigateUrl>
<AlternateText>SQL Server Curry Home Page</AlternateText>
<Impressions>20</Impressions>
<Keyword>small</Keyword>
</Ad>
<Ad>
<ImageUrl>~/images/writeforus.jpg</ImageUrl>
<Width>300</Width>
<Height>50</Height>
<NavigateUrl>http://www.dotnetcurry.com/writeforus.aspx</NavigateUrl>
<AlternateText>dotnetcurry.com Write For Us</AlternateText>
<Impressions>40</Impressions>
<Keyword>small</Keyword>
</Ad>
</Advertisements>
Step 4: Our next step is to add the AdRotator control and bind it to the advertisement file. Drag and drop an AdRotator control from the toolbox to the Default.aspx. To bind the AdRotator to our XML file, we will make use of the ‘AdvertisementFile’ property of the AdRotator control as shown below:
<asp:AdRotator
id="AdRotator1"
AdvertisementFile="~/App_Data/Ads.xml"
KeywordFilter="small"
Runat="server" />
Note: The ‘KeywordFilter’ property enables you to filter advertisement using a keyword. If your Advertisement file contains different kinds of ads (banner, leaderboard, skyscraper etc.), you can use this property to filter out different ads on different sections of the page. If you observe, the ads.xml file also contains a property called ‘Keyword’ which binds that ad with the AdRotator that contains the same KeywordFilter, in our case ‘small’.
If you run the sample now, you will have to refresh the page to display a new advertisement. In the last step, let us see how to rotate the ads without refreshing the page.
Step 5: To rotate the ads without refreshing the page, we will add some AJAX code to the page. The trick is to drop the AdRotator in an UpdatePanel and then use a Timer control to refresh the contents at regular intervals. The resultant code will be as shown below:
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Timer ID="Timer1" Interval="2000" runat="server" />

<asp:UpdatePanel ID="up1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:AdRotator
id="AdRotator1"
AdvertisementFile="~/App_Data/Ads.xml"
KeywordFilter="small"
Runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
If you observe, we have used Triggers inside an UpdatePanel. Triggers enable the UpdatePanel to refresh its content from a control outside the UpdatePanel. In our case, the Timer control is the control outside the UpdatePanel, which updates the content of the UpdatePanel. The content here is the AdRotator control.
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
The Event captured is the ‘Tick’ event of the Timer control. So every time the Timer control raise a tick event, an async postback occurs and the contents of the UpdatePanel is refreshed and that is how you are able to see the AdRotator control refresh its content at regular intervals.
So that was a quick tip on how to rotate ads using the AdRotator at regular intervals without refreshing the page. The source code of the article can be downloaded from here. I hope this article was useful and I thank you for viewing it.

Hope this will helps to you..........

Thanks & Regards,
Veeraraghavan J

********************************************
Kindly don't forget to rate this response...
********************************************


 
#368557    Author: Yogesh      Member Level: Gold      Member Rank: 1303     Date: 20/Apr/2009   Rating: 2 out of 52 out of 5     Points: 2

Hi,

Use Ajax timer control and trigger the ad rotator with asynchronous postback.


Warm regards,
Yogesh


 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Return to Discussion Forum
Start new thread

Subscribe to Subscribers
Awards & Gifts
Talk to Webmaster Tony John

Online Members

Anil kushawaha
More...
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India