in

Chennai .Net User Group

A platform that enables you to Learn, Share & Grow (India's first .Net user group)
Latest post 08-04-2009 9:43 AM by Pragash. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-02-2009 6:59 AM

    AJAX Image Refresh problem

    Hi,

     We are working on an ASP .NET application using .NET 2.0 and AJAX.
    The main page of the application has a user control, which is a multi-view control.
    This control has an instance of ScriptManager and UpdatePanel. The problem that I am talking about is in one of the views where the user
    confirms the selected information.

        A screen shot of the same view is attached. The user enters a random number, as seen in the image, in the text box. In case the number generated is not clear, user
    can change the number by clicking the Change button. THE PROBLEM IS THAT THE IMAGE DOESN'T GET UPDATED FOR ALL THE CHANGE BUTTON CLICKS.


        For your information, the image is implemented as an aspx page shown below :

    <img alt="Please try again" src="MyImageSource.aspx" id="imgMy" runat="server" enableviewstate="true"  /></td>


             A quick analysis of the http communication shows that partial page update is happening for the view( http response has the latest data for the view).But image
    is not getting updated. In cases, where the image gets updated ( once in three for four clicks), we can see that a separate HTTP GET request is sent for MyImageSource.aspx.

    What could be the problem ?


    Included below are the Response header being set to make sure that there are no IMAGE cache.

    Response.Expires = -1;
    Response.AddHeader("Pragma", "no-cache");
    Response.AddHeader("cache-control", "no-store");

    Anybody having experienced similar problem ?

     

    With Regards
    Ajit

  • 08-04-2009 9:43 AM In reply to

    • Pragash
    • Top 75 Contributor
      Male
    • Joined on 11-10-2008
    • Posts 1
    • Points 5

    Re: AJAX Image Refresh problem

    HI Man,

    I've gone through a similar situation where the same thing happened to me. I tried so many ways as u've and found nothing to work. But, there is a work around to this issue that is,

    When u click the button just change the SRC url of the image as below,

    MyImageSource.aspx?Flag=RandomeNumber

    Create a RandomeNumber and pass it as the value for the querystring (Probably GUID). Since, this will generate a new idd all the time and that SRC will identified as  a new src and will be loaded successfully.

    Hope this helps.

    Cheers,

    Pragash

     

    Filed under:
Page 1 of 1 (2 items)
Copyright © 2002-2008 Chennai .Net User Group. All Rights Reserved. Microsoft and Microsoft logo's are trademarks of Microsoft Corporation