I've searched for almost 2 days on the internet to find solution but nothing works yet.
I have 2 user controls on a page. First contains AsyncFileUpload:
<cc1:AsyncFileUpload runat="server" ID="fuExcelUploader" Width="400px"
UploadingBackColor="#CCFFFF" ThrobberID="myThrobber"
CompleteBackColor="#CEF6CE" />
and the second has a gridview with such templatefield with download button(excel file)
<asp:TemplateField HeaderText="Report with errors" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton id="lbError" CommandName="ErrorClick" runat="server" CommandArgument='<%# Eval("Report.Id") %>' ValidationGroup="other2357"><asp:Image ID="imgReport" runat="server"
ImageUrl="~/App_Themes/Default/Images/icons/page_excel.png" ImageAlign="Middle" Visible='<%# Convert.ToInt32(Eval("Report.Id")) > 0 %>' /></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
In the RowCommand if e.CommandName = ErrorClicked I have such piece of code for downloading file
Response.Clear();
Response.Buffer = true;
Response.AddHeader(
"Content-Disposition", string.Format("attachment; filename={0}", "Error_report_" + this.ErrorClicked + ".xlsx"));
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats";
// Response.Cache.SetCacheability(HttpCacheability.Private);
Response.BinaryWrite(value); //value is byte[];
Response.End();
It works perfect I can upload files with asyncfileupload then download reports by clicking icons on gridview etc. , but there is one problem.
Whenever I click on download icon on gridview, the download file dialog pops up, I can save/open/cancel but whatever I do, after I try to upload new file with asyncfileupload the same RowCommand event is fired with same 'ErrorClick' CommandName and CommandArgument, so I am getting that window with file to download again (and page is locked). It might be because neither linkbutton nor asyncfileupload refresh whole page (is it the same postback?).
Do you have any idea why the rowcommand is fired during uploading with asyncfileupload control or how to solve that problem. I don't use udpatepanels in this case.