导出功能后,ASP页面冻结 [英] ASP page freezes after export functionality

查看:77
本文介绍了导出功能后,ASP页面冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的网页上有一套asp控件,如下所示

Hi,

I have a set of asp controls in my web page as below

<asp:DropDownList ID="ddlScope" runat="server" CssClass="combobox noMarginBottom marginRight10 floatLeft"></asp:DropDownList>
                            <asp:Button ID="btnApplyfilter" runat="server" Text="Apply Filter" OnClick="BtnApplyfilter_Click" CssClass="submitBtn floatLeft marginRight10 marginLeft10" />
                            <asp:Button ID="btnClearfilter" runat="server" Text="Clear Filter" OnClick="BtnClearfilter_Click" CssClass="submitBtn floatLeft marginRight10" />
                            <asp:Button ID="btnExport" runat="server" Text="Export" OnClick="BtnExport_Click" CssClass="submitBtn floatLeft marginRight10" />      





当我点击每个按钮时,会有一个页面提交。一切正常,直到我们点击导出按钮。当我们点击导出按钮时,我们使用下面的代码将一些数据导出到excel





When i click each and every button there is a page submit. It all works fine until we click the export button. When we click the export button we are exporting some data to excel using the code below

var response = Context.Response;
               response.Clear();
               response.ClearHeaders();
               response.ClearContent();
               response.AddHeader("Content-Disposition", string.Concat("attachment; filename=Data_", string.Format("{0:yyyyMMdd_hhmmsstt}", DateTime.Now), ".xlsx"));
               response.AddHeader("Content-Length", buffer.Length.ToString());
               response.ContentType = "application/vnd.ms-excel";
               response.Flush();
               response.BinaryWrite(buffer);
               response.End();





但是在导出文件后,页面会冻结。所有按钮点击都不起作用。



任何人都可以帮帮我。



谢谢

Arjun Menon



But after the file are exported the page just freezes. All buttons clicks wont work.

Can anyone please help me out.

Thanks
Arjun Menon

推荐答案

将此方法添加到您的页面:

Add this method to your page:
public override void VerifyRenderingInServerForm(Control control)
   {
       // Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
   }


这篇关于导出功能后,ASP页面冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆