Uploader1.FileUploaded Event Being Raised Twice

Last post 09-16-2009, 2:22 PM by gBurgur. 5 replies.
Sort Posts: Previous Next
  •  09-14-2009, 10:42 PM 55631

    Uploader1.FileUploaded Event Being Raised Twice

    Why is the asp.Net server side event is being raised twice?
    What am I doing wrong that the event is being raised twice?
    Does that mean the file is being downloaded twice?

    Protected
    Sub Uploader_FileUploaded(ByVal sender As Object, ByVal args As CuteWebUI.UploaderEventArgs) Handles Uploader1.FileUploaded
       Dim b1 as Integer = 0       <<<<< PUTTING A BREAKPOINT HERE. It is getting hit twice.
    End Sub 
     
    Here is the HTML
     
    <form id="form1" runat="server">
    <div class="content">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Label ID="Label1" runat="server" CssClass="lbl_Messages">
                    Do NOT delete the file(s) you have uploaded until<br />
                    you confirm the successful transfer\decryption of all the files.
                </asp:Label>
                <br />
                <p>
                    Select multiple files in the file browser dialog then upload them at once</p>
                <CuteWebUI:Uploader runat="server" ID="Uploader1" InsertText="Upload Multiple Files (Max 10M)" MultipleFilesUpload="true" OnFileUploaded="Uploader_FileUploaded">
                    <ValidateOption MaxSizeKB="10240" />
                </CuteWebUI:Uploader>
                <br />
                <br />
                <div>
                    Server Trace:
                    <br />
                    <asp:ListBox runat="server" ID="ListBoxEvents" Width="400"></asp:ListBox>
                </div>
                <br />
                <br />
                <asp:Button ID="ButtonPostBack" Text="This is a PostBack button" runat="server" OnClick="ButtonPostBack_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
     
    Filed under:
  •  09-15-2009, 1:12 AM 55638 in reply to 55631

    Re: Uploader1.FileUploaded Event Being Raised Twice

    Hi
     
    What version are you using ?
     
    the Uploader did have that bug before,
     
    But we had fixed it long time ago.
     
    Regards,
    Terry
     
  •  09-15-2009, 4:03 PM 55666 in reply to 55638

    Re: Uploader1.FileUploaded Event Being Raised Twice

    How do I find out what version I have?  I did just downloaded the software a few days ago and perhaps I downloaded the wrong zip.
     
    Thanks,
    Gene
     
  •  09-16-2009, 12:16 PM 55691 in reply to 55666

    Re: Uploader1.FileUploaded Event Being Raised Twice

    Gene,
     
    If you downloaded the control a few days ago, you are using version 3.0.
     
    To check the control version, please put the mouse over the DLL and read the control description.
     
    For your problem, please try the following code:
     
    1. <%@ Page Language="C#" %>  
    2. <script runat="server">  
    3.     void Uploader_FileUploaded(object sender, UploaderEventArgs args)   
    4.     {   
    5.         Uploader uploader = (Uploader)sender;   
    6.         //Copys the uploaded file to a new location.   
    7.         //args.CopyTo("c:\\temp\\"+args.FileName);   
    8.     }   
    9. </script>  
    10.   
    11. <html>  
    12. <head>  
    13. </head>  
    14. <body>  
    15.     <form id="form1" runat="server">  
    16.        <CuteWebUI:Uploader runat="server" ID="Uploader1" OnFileUploaded="Uploader_FileUploaded"></CuteWebUI:Uploader>  
    17.     </form>  
    18. </body>  
    19. </html>  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  09-16-2009, 2:02 PM 55694 in reply to 55691

    Re: Uploader1.FileUploaded Event Being Raised Twice

    Confirmed Version 3.0.0.0  Date Create: 9/14/2009 2:46 AM  Size 276 KB
     
    I will try your code and let you know.
     
    Thanks,
    Gene
     
    Filed under:
  •  09-16-2009, 2:22 PM 55695 in reply to 55691

    Re: Uploader1.FileUploaded Event Being Raised Twice

    Solution.

    WRONG way - PRODUCES DOUBLE CALLBACK
    <CuteWebUI:Uploader runat="server" ID="Uploader1" OnFileUploaded="Uploader_FileUploaded">
      <ValidateOption MaxSizeKB="10240" />
    </CuteWebUI:Uploader>



    CORRECT way - ELMINATES DOUBLE CALLBACK
    <CuteWebUI:Uploader runat="server" ID="Uploader1" >
      <ValidateOption MaxSizeKB="10240" />
    </CuteWebUI:Uploader>


    Apprently putting in the OnFileUploaded="Uploader_FileUploaded"
    into the vb.Net produces the second callback.  Once because the
    Handles Uploader1.FileUploaded is naturally called by VB and
    the second time because the HTML itself contains
    OnFileUploaded="Uploader_FileUploaded".

    CODE-BEHIND
    -----------
    Protected Sub Uploader_FileUploaded(ByVal sender As Object,
                                        ByVal args As CuteWebUI.UploaderEventArgs) _
                                        Handles Uploader1.FileUploaded << repetitive
                                        ==============================

                                        
    It was kind of a "duh" once I saw the solution.


    Thanks a ton for working through the solution with me.
     
    Gene
     
     
     
    Filed under:
View as RSS news feed in XML