首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

GridView的打印有关问题

2011-12-15 
GridView的打印问题如题,最好能给个实例privatevoidExportDataGrid(stringFileType,stringFileName){Respo

GridView的打印问题
如题,最好能给个实例
private   void   ExportDataGrid(string   FileType,   string   FileName)
        {
                Response.Charset   =   "GB2312 ";
                Response.ContentEncoding   =   System.Text.Encoding.GetEncoding( "GB2312 ");

                Response.AppendHeader( "Content-Disposition ",   "online;filename= "   +   HttpUtility.UrlEncode(FileName,   Encoding.UTF8).ToString());
                Response.ContentType   =   FileType;
                this.EnableViewState   =   true;
                StringWriter   tw   =   new   StringWriter();
                HtmlTextWriter   hw   =   new   HtmlTextWriter(tw);
                this.GridView1.RenderControl(hw);
                //this.GridView1.R
                Response.Write(tw.ToString());
                Response.End();
        }
         
        protected   void   Button1_Click1(object   sender,   EventArgs   e)
        {
              ExportDataGrid( "online/ms-excel ",   "111.xls ");
        }

        public   override   void   VerifyRenderingInServerForm(Control   control)
        {
              base.VerifyRenderingInServerForm(control);
        }
这是我找到的,但不好用,总弹出一个提示错误的英文对话框.
请大家帮忙解决.

[解决办法]
学习 关注
[解决办法]
up
[解决办法]
不会 帮顶
[解决办法]
这个程序是导出Html页面的吧

热点排行