怎么把DataGrid导出成.txt文件并保存到客户端?
我用了以下代码:Response.Clear();
Response.Buffer= true;
Response.Charset="utf-8";
Response.AppendHeader("Content-Disposition","attachment;filename=FileFlow.txt");
Response.ContentEncoding=System.Text.Encoding.GetEncoding("utf-8");
Response.ContentType = "application/ms-txt";
this.EnableViewState = false;
oStringWriter = new ();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
DataGrid4.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
但是导出的txt文件里包含一大堆html代码。怎么解决啊?