Image URL not changing in Update panel

Posted by Chiefy on Stack Overflow See other posts from Stack Overflow or by Chiefy
Published on 2010-03-11T12:25:49Z Indexed on 2010/05/20 12:10 UTC
Read the original article Hit count: 321

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!

© Stack Overflow or respective owner

Related posts about updatepanel

Related posts about asyncfileupload