Monday, March 26, 2012

prevent asp:ImageButton from refreshing image...

Is there a way (with the Dec release) to prevent the image in an image button from refreshing when posting back to the server in an UpdatePanel?

It would seem to defeat the purpose of Ajax to have this image refresh all the time during a post to the server...

Wade.

The idea would be to keep the image button outside the updatepanel so it is not refreshed when the page is posted back.

- Kashif


Actually the behavior is browser dependent. Internet Explorer seems to refresh images by trying to go to reload the image, while Mozilla seems to cache images completely locally and without that funky flash.

In IE if you replace content that contains images references (as UpdatePanel will do) all the images reload. Usually they will come from Cache so it's pretty fast, but there's still some amount of flash. If you use FireFox you don't get that flash. You can hook up Fiddler or other HTTP proxy to see this behavior.

Certainly makes for smoother operation of any sort of callback in FireFox.

+++ Rick --


The best method is to have a script manager control on the page with 'Enable Partial Rendering' set to 'True', and then only put the parts of your page that would be updated on a page refresh within the UpdatePanel controls.

So if you don't want the image to 'blink', it's best to leave it outside of that control.


This is a problem that is currently driving me nuts. I have a large UpdatePanel that has a tab control on it. The tabs are painted using image backgrounds defined in a stylesheet. In IE, using Nikhil's web dev tool, I can see that for every tab all the images are requested and the server responds with code 200. It's like IE's local cache is completely ignored. This is causing an ugly flicker and some repaint issues. I've tried the max-age cache control-cache extension but it doesn't seem to work. I found the best information athttp://aspnetresources.com/blog/cache_control_extensions.aspx.

Does anyboy have any ideas?

This bug is going to kill me too. all the images on the page even those are outside the updatepanel and wrote with <img> tag are flikering too.

Any solution to resolve this problem?


The image flicker has nothing to do with ATLAS - it's an IE bug - IE is refreshing the images when it shouldn't. You can fix that by changing your IE cache settings. I think it happens if you have your cache set to refresh on every page hit. IE apparently considers the partial XmlHttp postback as a page refresh and refreshes all content in the page. Put IE back to auto caching and the flickering should stop.

+++ Rick --


Dear Rick

Thanks For Comment

My IE Caching was set to Auto Already, and here still the killer bug.

Any other Idea?

H.B.F


Hello. This is a bug in IE when it's pulling in background images defined in CSS. As far as I am aware, the solution lies within IIS. Have a read of this: http://erik.eae.net/archives/2007/02/26/13.13.48/

cheers
Anthony

No comments:

Post a Comment