hai i have used adrotator in top of the page and left i have link buttons which is in panel .
Then right i have iframe..tat iframe shows the page which is clicked by link button. but my adrotator picture is not changing.but when i refresh the page its changed..
so tel me the solution for changing the adrotator picture . i have given impression also
and i have used
<meta http-equiv="refresh" content="2">
this is t working .but the problem is when the page is refreshed,then the whole page is refreshed.but i need that adrotator alone should refreshed
so pls help me for this.


Thank you,

Dani AI

Generated

Short expert note that complements the thread (references below)

The root cause: the ASP.NET AdRotator chooses its image on the server when its page is rendered, so any solution that forces a full-page refresh (meta refresh / Response.AppendHeader) will update the ad but also reload everything else. Given that already uses an iframe for the right-hand content, the simplest, lowest-risk fix is to host the AdRotator on a tiny standalone page and reload that iframe only. This avoids heavy partial-postback machinery and keeps impression counting on the server (AdRotator.Page_Load runs each iframe load).

Minimal implementation (place AdRotator in a small page like AdFrame.aspx, then refresh that iframe from the main page):

<iframe id="adFrame" src="/AdFrame.aspx" width="728" height="90" frameborder="0" scrolling="no"></iframe>

<script>
(function(){
  var ad = document.getElementById('adFrame');
  var base = ad.src.split('?')[0];
  setInterval(function(){
    ad.src = base + '?_=' + new Date().getTime();
  }, 10000); // change interval as needed
})();
</script>

Practical notes and tradeoffs

  • Use the timestamp query string to avoid browser caching.
  • Keep AdFrame.aspx minimal so it loads fast; do server-side impression logging there if needed.
  • If clicks should open in the parent window, make ad links target="_top" (or use simple JS from the ad page).
  • The UpdatePanel+Timer approach that mentioned works if server-side partial postbacks are required, but it is heavier; pure client-side rotation (AJAX/XML or JSON) is another option when server tracking is unnecessary (similar spirit to ’s suggestion).

This iframe approach is low-effort, preserves existing ad-rotation logic, and refreshes only the ad area rather than the whole page.

Recommended Answers

All 9 Replies

use timer control in ajax.with updatepanel ....i.e place adrotator in updatepanel...and for timer targetcontrol id as updatepanel triger evnt as pagelaod( tick something is there ) so page will not be refressed bt ad rotator will change its ads.....
mistakes are common.let me know if i make a mistake.thank u........

use timer control in ajax.with updatepanel ....i.e place adrotator in updatepanel...and for timer targetcontrol id as updatepanel triger evnt as pagelaod( tick something is there ) so page will not be refressed bt ad rotator will change its ads.....
mistakes are common.let me know if i make a mistake.thank u........

i do no how to use can u help me to do this....

That requires too much. Your best bet is to just change the picture through javascript.

<script type="text/javascript">
<!--//
function chnge()
{
document.getElementById("adRotator").src = "newimagepath";

//If you wish, put all your images in a folder
//that have similar names like:
//img001, img002, img003, img004
//Then take a random number, and check
//for certain ranges, like: if Less than 10,
//add two zeros in front of number. If less
//than 100, add one zero.

setTimeout("chnge()", 10000);

//This timout just calls the function every
//10 seconds. 1000 MS = 1 second,
//10,000 = 10 sec.
}
-->
</script>

That requires too much. Your best bet is to just change the picture through javascript.

<script type="text/javascript">
<!--//
function chnge()
{
document.getElementById("adRotator").src = "newimagepath";

//If you wish, put all your images in a folder
//that have similar names like:
//img001, img002, img003, img004
//Then take a random number, and check
//for certain ranges, like: if Less than 10,
//add two zeros in front of number. If less
//than 100, add one zero.

setTimeout("chnge()", 10000);

//This timout just calls the function every
//10 seconds. 1000 MS = 1 second,
//10,000 = 10 sec.
}
-->
</script>

hi,
in this place u gave some picture path..but i gave 3 pictures in adrotator (XML File).
if i give like this after 10 seconds once this image only get refreshed ...ten wat abt the remaining pictures.....
document.getElementById("adRotator").src = "newimagepath";


can u suggest me which pic i should give for src................

Thank you,

hi,
in this place u gave some picture path..but i gave 3 pictures in adrotator (XML File).
if i give like this after 10 seconds once this image only get refreshed ...ten wat abt the remaining pictures.....
document.getElementById("adRotator").src = "newimagepath";


can u suggest me which pic i should give for src................[in which event i have to write.......]

Thank you,

I sent you a PM, if it works, place the code you used and solve the thread, if not, let me know your situation and I'll attempt to solve it for you.

Response.AppendHeader("Refresh", "10; URL=YOUR URL")

Place this in Page load, and for evry 10 sec. u r page gets refreshed.

The ajax timer is a right approach. Easy and nice the complete page will not referesh.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.