AsyncFileUpload postback causes double upload

前端 未结 6 1729
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 02:32

I implemented the AsyncFileUpload control on a web page. This web page requires uploaded files to appear in a GridView.
The GridView

6条回答
  •  感情败类
    2020-12-07 03:16

    I don't have access to your sample solution which contains the issue but i encounter a double postback too in my project with the AsyncFileUpload component. I found a very simple workaround :

    Just add:

    private bool justUploaded = false;
    

    Then:

    void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e)
    {
        if (justUploaded) return;
        justUploaded = true;
        // rest of your upload code
    }
    

提交回复
热议问题