在导出gridview分页时出现问题,使excel成为可能,我无法导出为excel,因为它指出了一个错误并且我还不能解决它,所以我在这里寻求帮助
protected void Sqldata_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
Sqldata.PageIndex = e.NewPageIndex;
Sqldata.DataSource= SqlDataSource1 ;
Sqldata.DataBind();
DataBind();
}
public override void VerifyRenderingInServerForm(System.Web.UI.Control control)
{
//confirms that an HtmlForm control is rendered for the
//specified ASP.NET server control at run time.
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.AppendHeader("content-disposition", "attachment; filename=register.xls");
Response.ContentType = "applicantion/excel";
StringWriter ad = new StringWriter();
HtmlTextWriter sd = new HtmlTextWriter(ad);
Sqldata.RenderControl(sd);
Response.Write(ad.ToString());
Response.End();
}