gridview导出excel的问题,不弹出保存对话框
public void ExportToExcel(System.Web.HttpResponse response, System.Web.UI.Page page, string strHtml)
{
response.Cache.SetExpires(DateTime.Now.AddSeconds(1));
response.Clear();
response.AddHeader("content-disposition", "attachment;filename=filename.xls"); ;
response.Charset = "";
response.Cache.SetCacheability(HttpCacheability.NoCache);
response.ContentType = "application/vnd.ms-excel";
page.EnableViewState = false;
response.Write("\r\n");
response.Write(strHtml);
response.End();
}
我用这段代码 ,导出到excel的时候,他会弹出一个保存,打开的对话框,是否有办法可以屏蔽掉