C# 数据表到Excel的转换使SharePoint Web部件中的“我的服务器端”按钮没有响应

C# 数据表到Excel的转换使SharePoint Web部件中的“我的服务器端”按钮没有响应,c#,asp.net,sharepoint,C#,Asp.net,Sharepoint,我们有一个web部件,在上面以网格形式显示一些数据。我们正在将网格的底层数据表导出到Excel,并在单击服务器端按钮时显示Open-Save-Cancel拨号框 this.Page.Response.Clear(); this.Page.Response.AppendHeader("Content-Disposition", "attachment; filename=MyTasks.xls"); this.Page.Response.ContentType = "application/ms-

我们有一个web部件,在上面以网格形式显示一些数据。我们正在将网格的底层数据表导出到Excel,并在单击服务器端按钮时显示Open-Save-Cancel拨号框

this.Page.Response.Clear();
this.Page.Response.AppendHeader("Content-Disposition", "attachment; filename=MyTasks.xls");
this.Page.Response.ContentType = "application/ms-excel";
this.Page.Response.Write("...here goes my well formated html....");
this.Page.Response.End();
下面是我们在点击服务器端按钮时执行的代码

this.Page.Response.Clear();
this.Page.Response.AppendHeader("Content-Disposition", "attachment; filename=MyTasks.xls");
this.Page.Response.ContentType = "application/ms-excel";
this.Page.Response.Write("...here goes my well formated html....");
this.Page.Response.End();
问题是,当我在diaglouge框中单击Cancel时,打开/保存excel的对话框消失,但放置在我的web部件上的所有服务器端按钮变为非响应按钮,单击这些按钮中的任何一个都不会触发其服务器端单击事件

有什么想法吗


谢谢。

我得到了它,我必须使用window.open脚本打开同一页,我在服务器端使用RegisterStartupScript按钮单击事件执行该脚本(我正在将数据表导出到excel),在页面加载时,我将检查是否单击了导出到excel按钮,然后执行上述代码以呈现excel