This is a migrated thread and some comments may be shown as answers.

[Solved] Image not binding for the second time.

1 Answer 3 Views
Upload
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Prasad
Top achievements
Rank 1
Prasad asked on 03 Jan 2013, 10:12 AM
I am using Telerik MVC Extensions Upload control for uploading an Image. An Image tag is used with "src" property "ControllerName/actionName". Code is below:
@(Html.Telerik().Upload()
      .Name("attachments")
      .Multiple(false)
      .ShowFileList(false)
      .ClientEvents(events => events
                    .OnSuccess(@<text> function(e) {displayTempSuccess(e);}</text>)
                    .OnUpload(@<text>function (e){ telerikUpload(e)}</text>)
                   )
      .Async(async => async.Save("Save", "Recipe")
                           .AutoUpload(true))
      )
on upload i change the binary data of the image in session object with newly uploaded image and on "displayTempSuccess
" method i change the image source. In all the browsers the new image is getting displayed but in IE 9.
I monitored the server calls, in all browsers the /Recipe/GetImage call is firing for second time but IE 9.

function displayTempSuccess(e) {
        $('#yourImageId').removeAttr("src");
        $('#yourImageId').attr('src', '../Recipe/GetImage');
    }

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 08 Jan 2013, 08:13 AM
Hello,

Perhaps IE is loading the image from cache as the actual URL remains unchanged. You might try to add a "cachebuster" to the image URL:

$('#yourImageId').attr('src', '../Recipe/GetImage?t=' + new Date().getTime());

I hope this helps.

Greetings,
Tsvetomir Tsonev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Upload
Asked by
Prasad
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or