主页是用frameset分成左右结构的框架html页面,左边是树页面,是aspx页面,点树之后,右边出现我的查询页面,然后保存为excel格式的文件,当保存到本地之后,按树想打开其他页面,就没反应了.必须按保存为,然后取消之后,才能继续使用树~~~不知道是什么原因~~请指教~~
以下代码写在"保存"的button事件里~
string Filename,city;
city=ddl.SelectedItem.Value;
Filename=year1.Text+month1.Text+city+"yf"+".xls"; Response.Clear();
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename="+Filename);
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWrite(oStringWriter);
this.Panel1.RenderControl(oHtmlTextWriter);
Response.Write("<meta http-equiv=Content-Type content=text/html;charset=gb2312>");
Response.Write(oStringWriter.ToString());
Response.End();
以下代码写在"保存"的button事件里~
string Filename,city;
city=ddl.SelectedItem.Value;
Filename=year1.Text+month1.Text+city+"yf"+".xls"; Response.Clear();
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename="+Filename);
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWrite(oStringWriter);
this.Panel1.RenderControl(oHtmlTextWriter);
Response.Write("<meta http-equiv=Content-Type content=text/html;charset=gb2312>");
Response.Write(oStringWriter.ToString());
Response.End();
你可以把保存excel的页面放入一个iframe中,把树与这个页面分开,以免影响
一般涉及到导入excel。最好用新的页面。
要不response.end()就完了。