导出问题!~
protected void Button2_Click(object sender, EventArgs e){
Export("application/ms-excel", "ywsl.xls");
}
private void Export(string FileType, string FileName)
{
//导出GridView到Excel表的的按钮
Response.Clear();
Response.Buffer = true;
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
string FileNames = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
Response.AddHeader("Content-Disposition", "attachment;filename=" + FileNames);
Response.ContentType = "application/ms-excel";
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
}
这样的代码。点击导出按钮,看见一个导出窗口闪了一下,不知道啥意思了!代码以前就写过,可用,现在变成这样! --------------------编程问答-------------------- http://topic.csdn.net/u/20110701/09/fa548ccf-ac0d-4573-bda8-e576bda9476f.html?30034
补充:.NET技术 , ASP.NET