views:

344

answers:

2

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!

A: 

I'm experiencing this problem also. Any thoughts?

Malin O
A: 

Use the OnClientUploadComplete event and jQuery :>

Genady Sergeev