bt事件如下,但是点击没反应?奇了个怪了?
哪里出错了? protected void Button1_Click(object sender, EventArgs e)
{
Export("application/ms-excel", "考勤.xls");
}
private void Export(string FileType, string FileName)
{
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName + ".xls");
GridView1.Page.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
GridView1.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End(); }
public override void VerifyRenderingInServerForm(Control control)
{
}
哪里出错了? protected void Button1_Click(object sender, EventArgs e)
{
Export("application/ms-excel", "考勤.xls");
}
private void Export(string FileType, string FileName)
{
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + FileName + ".xls");
GridView1.Page.EnableViewState = false;
System.IO.StringWriter tw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
GridView1.RenderControl(hw);
HttpContext.Current.Response.Write(tw.ToString());
HttpContext.Current.Response.End(); }
public override void VerifyRenderingInServerForm(Control control)
{
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货