I have page which contains 2 gridview and 2 mschart. ı want to export this page to excel. For this purpose I took these controls into a panel and write this code:
Response.Clear();
Response.ContentType = "application/vnd.msexcel";
Response.AddHeader("content-disposition", "attachment; filename=rapor.xls");
Response.ContentEncoding = System.Text.Encoding.Default;
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
panel1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
When this code run, everything is ok except charts. They aren't coming to excel. How can I do it?