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页面的吧