473,396 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ASP.NET - Image reading from cache!

Hello experts,

I have an Ajax UpdatePanel inside my page. When I click on the "Change Image" button inside it, the image in that panel will change dynamically, based on an external XML file, that I created to manage the images to display.

Note that most of the time the image change, but sometimes, when I click the button, the image doens't change, and I have to click once more, or sometimes twice, for the image to change.

Do you think guys this is happening because only the ajax area is refreshing and not the whole page? How can I solve this problem? Is there any way to avoid an image to read from the cache, even if it's inside an Ajax UpdatePanel?

Please advice...

Best regards,
Wassim
Feb 28 '08 #1
5 3072
shweta123
692 Expert 512MB
Hi,

I think the you are getting refresh problem of the image because you have taken the Button inside the update panel.Only image should be inside the panel.
e.g.

Expand|Select|Wrap|Line Numbers
  1. <asp:Button ID="Button1" 
  2.                 Text="Refresh Panel"
  3.                 runat="server" />
  4.     <asp:ScriptManager ID="ScriptManager1" 
  5.                        runat="server" />
  6.     <asp:UpdatePanel ID="UpdatePanel1" 
  7.                      UpdateMode="Conditional"
  8.                      runat="server">
  9.                      <Triggers>
  10.                        <asp:AsyncPostBackTrigger ControlID="Button1" />
  11.                      </Triggers>
  12.                      <ContentTemplate>
  13.                      <img id="Image1" src=".."/>
  14.                       </ContentTemplate>
  15.     </asp:UpdatePanel>
  16.  

Hello experts,

I have an Ajax UpdatePanel inside my page. When I click on the "Change Image" button inside it, the image in that panel will change dynamically, based on an external XML file, that I created to manage the images to display.

Note that most of the time the image change, but sometimes, when I click the button, the image doens't change, and I have to click once more, or sometimes twice, for the image to change.

Do you think guys this is happening because only the ajax area is refreshing and not the whole page? How can I solve this problem? Is there any way to avoid an image to read from the cache, even if it's inside an Ajax UpdatePanel?

Please advice...

Best regards,
Wassim
Feb 28 '08 #2
Frinavale
9,735 Expert Mod 8TB
Hello experts,

I have an Ajax UpdatePanel inside my page. When I click on the "Change Image" button inside it, the image in that panel will change dynamically, based on an external XML file, that I created to manage the images to display.

Note that most of the time the image change, but sometimes, when I click the button, the image doens't change, and I have to click once more, or sometimes twice, for the image to change.

Do you think guys this is happening because only the ajax area is refreshing and not the whole page? How can I solve this problem? Is there any way to avoid an image to read from the cache, even if it's inside an Ajax UpdatePanel?

Please advice...

Best regards,
Wassim
By any chance, do you have some images with the same name that are being displayed with different content?
Sometimes the pictures are cached by the web browser and if they have the same name, wont re-download the newer picture.

Could you please post your asp code for the update panel :)

-Frinny
Feb 28 '08 #3
Thank you guys for your replies so far.

shweta123: Thank you my friend, at the beginning i placed a Trigger, and I had the same problem, and besides this, the w3c did not validate the page because of the trigger itself, so I took the button inside the UpdatePanel, and remove the trigger part and page was validated with no errors. But I assure to you the problem occured even when the button was outside the panel and handle it using the trigger.

Expand|Select|Wrap|Line Numbers
  1. <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  2. <ContentTemplate>
  3. <asp:Image ID="Image1" runat="server" BorderWidth="1px" BorderColor="#192742" BorderStyle="Dashed" Width="170" Height="90" AlternateText=" " />
  4. <br />
  5. <asp:Label ID="lblProject2" runat="server" Text="Label" ForeColor="#192742" Width="128px"></asp:Label>
  6. <br />
  7. <asp:Button ID="Button1" runat="server" Text="Scramble" Width="146px" />
  8. </ContentTemplate>                      
  9. </asp:UpdatePanel>
FYI: The ScriptManager is put at the top of the page.

Note that I am handling the source of the image through the code behind page. The images are displayed randomly through a list of 50 images. *Most* of the time, the images change, only few times I have to click twice.
And I don't think it's a luck that the random number retrieve the same number, because I actually have *TWO* images, and when this problem occur, the same two images stay at the same place, and the probability for this to happen is almost null, you already know...

Let's hope I gave you sufficient informations, and I appreciate your time helping me in this issue.
If you want guys I can send you a link to my page online to your email, but I can't put it here due to personal reasons, and for respecting the forum's rules as well.

Best regards,
Wassim
Feb 28 '08 #4
By any chance, do you have some images with the same name that are being displayed with different content?
Sometimes the pictures are cached by the web browser and if they have the same name, wont re-download the newer picture.

Could you please post your asp code for the update panel :)

-Frinny
Hello Frinny,

I have answered your questions above, but I thought I don't have to push the reply button under your reply, in order for the email to be sent to you. Please let me know if what I said above make any sense to you.

Best regards,
Wassim
Feb 29 '08 #5
shweta123
692 Expert 512MB
Hi,

If you are generating the images at the backend , please check that the image is present on the hard disk before displaying by debugging it.
It is also possible that image is created but it is blank so you can not see it.
Feb 29 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ken | last post by:
How does IE6 control the display of images? I change the content of a image file image1.jpg without changing the file name. Then jump to a new page to display it. IE6 does not displays the...
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
3
by: Brad | last post by:
I'm working on a web app which will display LARGE tiff image files (e.g files 10-20+ mb). Files are hidden from users direct access. For other, smaller image files I have used FileStream to read...
2
by: thehuby | last post by:
I am building a CMS and as part of it a user can upload an image. Once uploaded I am displaying the image. If the user then decides they want to replace the image with another I get a caching...
62
by: ivan.leben | last post by:
How can I really delete a preloaded image from memory/disk cache? Let's say I preload an image by creating an Image object and setting its src attribute to desired URL: var img = new Image();...
6
by: Mark Denardo | last post by:
I created a Web Image "<asp:Image ID="Image1" ..." that my code behind set to a certain image file say image1.jpg =Image1.ImageUrl = "<rel_path>/image1.jpg"; which set the image ok, but then I...
11
by: Jerry J | last post by:
How can I get an asp:Image to refresh when a user uploads a different jpg. I disabled caching using this command on Page_Load(): Response.Cache.SetCacheability(HttpCacheability.No Cache); but it...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
2
by: jeanray | last post by:
I have a site made entirely with AJAX, base PhP and MySQL, so the is only one page (index.php). The user goes through various selections and an image is formed (on the server), then sent back to the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.