Image URL not changing in Update panel
Ok this is probably really simple but I have been staring at it for too long now.
I have an AJAX AsyncFileUpload control that when a file is selected I want the Image next to it to change. I tried it in Javascript and it did nothing, i have since tried it server-side and still nothing. here is the client side. <asp:UpdatePanel runat="server" ID="upnlConfidential">
<ContentTemplate>
<td>
<asp:AsyncFileUpload ID="_flupCV" runat="server" OnUploadedComplete="AdminFileUpload" />
</td>
<td>
<asp:Image ID="imgCV" runat="server" Height="25px" Width="25px" ImageUrl="~/Images/Exclamation.png"/>
</td>
</ContentTemplate>
</asp:UpdatePanel>
and here is the server side
protected void AdminFileUpload(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
AjaxControlToolkit.AsyncFileUpload upload = (AjaxControlToolkit.AsyncFileUpload)sender;
if (upload.PostedFile != null)
{
switch (upload.ID)
{
case "_flupCV":
ImageCheckMark(imgCV);
break;
//etc...
}
}
}
private void ImageCheckMark(Image image)
{
image.Visible = true;
image.ImageUrl = "~/Images/CheckMark.开发者_如何学编程png";
}
When the server side is called it sets the URL just fine but then nothing happens to the image, when I call the code again the URL is still the previous Exclamation image. its almost like its forgotten.
Can anybody help me on this please. Thanks in advance to all who contribute!
Use the OnClientUploadComplete event and jQuery :>
精彩评论