protected void btnExceleAktar_Click(object sender, EventArgs e)
{
GridView1.AllowPaging = false;
this.GridDoldur(); // GridViewi Dolduruyoruz
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=DosyaAdi.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
using (StringWriter sw = new StringWriter())
{
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridView1.RenderControl(hw);
string style=@"<style> .textmode {} </style>";
Response.Write(style);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
}
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Excel için gerekli*/
}