I'm using a AjaxUpload for uploading a image to the server.
After the upload has been succesfull i need to display the image in a image control.
Here is my code:
$(function () {
new AjaxUpload('#UploadButton', {
action: 'UploadHandler.ashx',
onComplete: function (file, response) {
$("<div><img src='../Images/upload/btndelete.png' onclick=\"DeleteFile('" + response + "')\" class='delete'/>" + response + "</div>").appendTo('#UploadedFile');
$('#UploadStatus').html("file has been uploaded sucessfully");
$("#UploadButton").hide();
//Below i want to load the image to the image control
var fileUpload = response;
var img = document.getElementById("<%=this.Image1.ClientID%>");
img.src = fileUpload.value;
},
Other problem is i cant execute another function from this code..can somebody explain me how this come?
Clubict
Member
223 Points
195 Posts
displaying image in asp image control failes
Nov 21, 2012 08:08 PM|LINK
Hi,
I'm using a AjaxUpload for uploading a image to the server.
After the upload has been succesfull i need to display the image in a image control.
Here is my code:
$(function () { new AjaxUpload('#UploadButton', { action: 'UploadHandler.ashx', onComplete: function (file, response) { $("<div><img src='../Images/upload/btndelete.png' onclick=\"DeleteFile('" + response + "')\" class='delete'/>" + response + "</div>").appendTo('#UploadedFile'); $('#UploadStatus').html("file has been uploaded sucessfully"); $("#UploadButton").hide(); //Below i want to load the image to the image control var fileUpload = response; var img = document.getElementById("<%=this.Image1.ClientID%>"); img.src = fileUpload.value; },Other problem is i cant execute another function from this code..can somebody explain me how this come?
Best regards,
Mark
asteranup
All-Star
30184 Points
4906 Posts
Re: displaying image in asp image control failes
Nov 22, 2012 05:33 AM|LINK
Hi,
Debug you code and check what value of the src is getting assigned. You can check the following post to konw the path related issue.
http://forums.asp.net/p/1742058/4695188.aspx/1?Re+CSS+couldn+t+be+retrieve+
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
Clubict
Member
223 Points
195 Posts
Re: displaying image in asp image control failes
Nov 22, 2012 09:24 AM|LINK
Hi Asteranup,
Yes i found it out myself...But thanks for the tip..
Best regards,
Mark