Showing posts with label advertisements. Show all posts
Showing posts with label advertisements. Show all posts

Wednesday, March 28, 2012

Posting On Ajax Help Required.

Hi All,

My requirement is like displaying random advertisements in masterpage. I had a page with Ajax Timer control which on Timer_Tick event fetches me a new image and bind to <asp:hyperlink>, my problem is on page_load also i want to display image, but image is displayed only on Timer_Tick after some fixed 3000 seconds is elapsed. On page_load i want to display same images, my images are dynamic comes from database, i store them in a dataset, and binds to asp:hyperlink on timer_tick. Can anyone help, on how to display image on page_load, is there any way how i can attach the server side event (Timer_Tick) on page_load also, so that it will fetch me the image.

Thanks In Advance,

Karthikeyan.

Consider using the AdRotator control.

The AdRotator control selects and displays an ad randomly each time a page is refreshed.

The AdRotator control in ASP.NET 2.0 populates its image and navigation properties in 3 different ways -
Database, XML and also programmatically.

Check these links for more info & code samples -
http://www.ipona.com/samples/0321257278/11/AdRotator-Bound.aspx
http://www.ipona.com/samples/0321257278/SourceViewer/SrcView.aspx?file=/samples/0321257278/11/AdRotator-Bound.aspx
http://www.c-sharpcorner.com/UploadFile/mahesh/adrotator06142007110621AM/adrotator.aspx
http://blogs.msdn.com/acoat/archive/2005/11/07/AdRotator-Dynamic-Image-Generation.aspx


Thanks for your valuable suggestion, but my requirement is i don't want to do a postback for whole page, just for banner, what i want is to do a Asynchronous postback on fixed timer interval and change banner. First time when the page load there is no banner getting displayed. This is my problem, is there any way through which i can again call Timer_Tick event in page_load so that for the first time a image will be loaded.

Thanks & Regards,

karthikeyan.

Saturday, March 24, 2012

Problem by using adrotator and timer control for an atlas project

Hello.
I want to show the advertisements without page posting. I have an adrotator,an xml file,timer control,and an update panel. When I run the project only one advertisement is shown on the page then the page is blank.
My aspx.pages codes:

<div>
<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True">
</atlas:ScriptManager>
<atlas:TimerControl ID="TimerControl1" Interval="2000" runat="server" />
<atlas:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/ads.xml" />
</ContentTemplate>
</atlas:UpdatePanel>
</div
and ads.xml

<?xml version="1.0" encoding="utf-8" ?
<Advertisements>
<Ad>
<ImageUrl>Images/Book1.jpg</ImageUrl>
<NavigateUrl>http://www.Amazon.com/Book1.aspx</NavigateUrl>
<AlternateText>Book1</AlternateText>
<Impressions>2</Impressions>
<Keyword>Book</Keyword>
</Ad
<Ad>
<ImageUrl>Images/Book2.jpg</ImageUrl>
<NavigateUrl>http://www.Amazon.com/Book2.aspx</NavigateUrl>
<AlternateText>Book2</AlternateText>
<Impressions>2</Impressions>
<Keyword>Book</Keyword>
</Ad
<Ad>
<ImageUrl>Images/Book3.jpg</ImageUrl>
<NavigateUrl>http://www.Amazon.com/Book3.aspx</NavigateUrl>
<AlternateText>Book3</AlternateText>
<Impressions>3</Impressions>
<Keyword>Book</Keyword>
</Ad
<Ad>
<ImageUrl>Images/Book4.jpg</ImageUrl>
<NavigateUrl>http://www.Amazon.com/Book4.aspx</NavigateUrl>
<AlternateText>Book4</AlternateText>
<Impressions>3</Impressions>
<Keyword>Book</Keyword>
</Ad
</Advertisements
can you help me?The timer isn't in the UpdatePanel so you need to add the Tick event as a trigger.
Thanks for your reply but I tried it before too.
my aspx pages codes:

<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" >
<ErrorTemplate>
There was an error processing your action.<br />
<span id="errorMessageLabel"></span>
<hr />
<button type="button" id="okButton">OK</button>
</ErrorTemplate>
</atlas:ScriptManager>
<atlas:TimerControl ID="TimerControl1" Interval="2000" runat="server" OnTick="TimerControl1_Tick" />
<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional" >
<ContentTemplate>
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/Reklam2.xml" />
</ContentTemplate>

<Triggers>
<atlas:ControlEventTrigger ControlID="TimerControl1" EventName="Tick" />
</Triggers>
</atlas:UpdatePanel
timer tick event

protected void TimerControl1_Tick(object sender, EventArgs e)
{
UpdatePanel1.Update();
}

what is the wrong , I can not find the problem.
waiting for your reply...

Hello,

Is there anybody who can help me about this problem?


help,where is the error?
Hello,I solved the problem.

My aspx page

<form id="form1" runat="server">
<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" />
<br />
<atlas:TimerControl ID="TimerControl1" runat="server" Interval="2000">
</atlas:TimerControl>
<br />
<div>
<atlas:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/Reklam.xml" />
</ContentTemplate>
<Triggers>
<atlas:ControlEventTrigger ControlID="AdRotator1" EventName="AdCreated" />
</Triggers>
</atlas:UpdatePanel>
</div>
</form
I added a trigger.
<Triggers>
<atlas:ControlEventTrigger ControlID="AdRotator1" EventName="AdCreated" />
</Triggers>
Help of this trigger,when a new advertisement is taken,updatepanel is updating. So without refreshing advertisements are shown on the web site. Reklam.xml is similar to ads.xml, only the name is Turkish.


Thanks for your example, i follow your example to solved my problem:)
not matter