NeatUpload - Control Event Handler won't fire

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Loc Pham
    New Member
    • Jun 2011
    • 2

    NeatUpload - Control Event Handler won't fire

    I'm using NeatUpload to provide upload progress status bar. Can anyone please help me understand why the registered event handler did not get called after the file was completely uploaded?

    I'm using SqlServerUpload StorageProvider extender from NeatUpload 1.3.26 to stream the file directly into the database. The system event handler was registered in Page_Load method as follows:
    Code:
    private void Page_Load(object sender, EventArgs e)
    {
        button.Click += new System.EventHandler(this.Button_Clicked);
        ...
    }
    I monitored the DB and did see the file got pushed into the DB. After the file was completely uploaded, a postback did occurred, however, the Button_Clicked event handler was never called so I couldn't execute SqlInputFile.ve rify() to retain the file inside the DB. So eventually, the file which I uploaded got removed from the DB.

    Is there a way to list all the registered event handlers outstanding? I want to understand why the event was not invoked.... It almost seems as if the Button_Clicked event handler was lost somehow (or never registered). Do you know what might be the cause of this? I'm in great need of getting this to work, so if you can provide some feedback, I would greatly appreciate it.

    Regards,
    Loc Pham
    Last edited by Frinavale; Jun 23 '11, 01:30 PM. Reason: Added code tags.
  • Loc Pham
    New Member
    • Jun 2011
    • 2

    #2
    I'm able to find out more detail on this problem, still, I have no solution yet....

    After more debugging, the Button which triggered the SqlServerUpload never postback, however the Page_Load event did occur. Because no postback occurred, the control event handler UploadBtn_Click ed was never invoked.

    When I set the triggered button's UseSubmitBehavi or="false", the postback did occur, but SqlServerInputF ile1.HasFile evaluted to FALSE.

    Another interesting fact, when I upload an image that is about 10KB, everything works fine. When I upload an image that is about 700KB or larger, the problem is reproduced and postback won't occur.

    With these information, the postback event is definitely relate to the timing of the file being streamed into the DB. This explain why it works on my local development but does not work on the production. On my local development, all images 700KB or greater takes about 1 second to complete. The missing postback is only encountered when streaming the file takes 5 seconds or more ...

    So my question remains... where do I set this timeout and why does it occur???

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Check out this article: How to use dynamic controls in ASP.NET

      Try moving the following code out of the PageLoad event and into the PageInit event:

      Code:
      button.Click += new System.EventHandler(this.Button_Clicked)
      The problem is that I don't think that "button" will exist at that point...

      Comment

      • Rob S
        New Member
        • Jan 2011
        • 14

        #4
        Have you tried adding the handler in Page_Init?

        Comment

        Working...