可可果

哈利是一只有白点的黑狗

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
 1     private string ToRead(System.Web.UI.Control ctl)
 
2     {
 
3         // HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=Text01.txt");
 4         HttpContext.Current.Response.Charset = "GB2312";
 
5         HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;
 
6         //HttpContext.Current.Response.ContentType = "text/txt";//image/JPEG;text/HTML;image/GIF;vnd.ms-excel/msword
 7         ctl.Page.EnableViewState = false;
 
8         System.IO.StringWriter tw = new System.IO.StringWriter();
 
9         System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
10         ctl.RenderControl(hw);
11         //Response.Write(tw.ToString());
12         return tw.ToString();
13 
14         //HttpContext.Current.Response.Write(tw.ToString());
15         //HttpContext.Current.Response.End();
16     }
posted on 2007-10-17 14:32  可可果  阅读(194)  评论(0编辑  收藏  举报