请教一下sharepoint 2013应用程序页按钮只执行一次

huakaihualuo0216 2015-12-09 11:26:38
vs2013开发的sharepoint 2013应用程序页,上面加一下载文件的按钮,只要执行一次按钮事件,之后其他的按钮就不执行了,肯定是下载代码引起的,各种下载的代码都执行了,就是不行,只是sharepoint 2013环境中出现问题。记着之前sharepoint 2007时,在webpart中带下载按钮的事件,也会出现这样的问题,解决方法是加上this.btnDownload.OnClientClick = "this.form.onsubmit = function() {return true;}";这一句就好用了。现在在sharepoint 2013应用程序页中不起作用。
下面是按钮调用的下载方法。求指点。
protected bool WriteOutFile(string filePath)
{
System.IO.FileInfo pdfFile = new System.IO.FileInfo(filePath);
//写出文件
System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("gb2312");
HttpResponse response = HttpContext.Current.Response;
response.HeaderEncoding = encoding;
response.Charset = encoding.HeaderName;
response.Clear();
response.ContentEncoding = encoding;
response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(pdfFile.Name));
response.AddHeader("Content-Length", pdfFile.Length.ToString());
response.ContentType = "text/plain";// "application/pdf";
response.WriteFile(pdfFile.FullName);
HttpContext.Current.ApplicationInstance.CompleteRequest();
return true;
}
...全文
99 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Justin-Liu 2015-12-13
  • 打赏
  • 举报
回复
打开一个新页去完成下载逻辑

3,242

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 SharePoint
社区管理员
  • SharePoint社区
  • 霖雨
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧