这段代码是把页面所有的内容导入到EXECL,导入是可以成功的,但是导入了以后我当前的页面就死机了,我也不知道为什么,怎么才能解决这个问题?
Button1.Visible=false;
Response.Clear();
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename=FileFlow.xls");
Response.ContentEncoding=System.Text.Encoding.UTF8;
Response.ContentType = "application/ms-excel";
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",t
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
Button1.Visible=false;
Response.Clear();
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename=FileFlow.xls");
Response.ContentEncoding=System.Text.Encoding.UTF8;
Response.ContentType = "application/ms-excel";
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",t
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
解决方案 »
- 怎么实现:点选 GridView 里的CheckBox取该行的值??
- asp.net 后台向前台写页面问题
- 字符串后面跟了很多\0\0\0\0\0\0\0\0\0这么怎么将字符串取出来?
- HashTable类有什么用处,在什么情况下使用它啊
- 求一数组排列算法
- ~~~~~~~!孟兄来看看啊!~~~~~~~~~~~~~~
- 编译器错误消息: CS0433: 类型“ASP.leftlist_ascx"
- Jascript实现 等待 的问题, 高手看过来。
- 关于客户端的数据校验问题,要求不用VS自带的控件!
- 请教DataGrid,Repeater和DataList的区别及其使用的场合。
- 求助:很简单的代码,请帮忙看看问题出在哪里?谢谢!!!
- 请问在asp.net中数据类型integer和int32有何不同
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",t
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
{
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState= false;
System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
this.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
}
try{}
catch{}
试试
Response.Write(oStringWriter.ToString());我感觉这里有问题
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename=FileName.xls");
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.HtmlTextWriter(oStringWriter);
this.dgData.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
localtion.href=XXX
localtion.href=XXX这段单吗那里写?
http://community.csdn.net/Expert/topic/4038/4038223.xml?temp=.9106714
http://www.cnblogs.com/hbzxf/archive/2004/07/12/23456.html
<script>parent.location.href='main.aspx';window.close();</script>
试一下