Ebru Kapan

Ebru Kapan

  • NA
  • 16
  • 1.4k

How can I export images from ASPxGridView to excel in .net?

Nov 23 2017 9:07 AM
protected void btnXlsExport_Click(object sender, EventArgs e)
{
//GridExporter.WriteXlsToResponse();
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=MyFiles.xls");
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
ASPxGridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}

Answers (1)