Hi All,
This is my code...
showing format extenton error. If i click yes after open excel file..
Please hele me.
Response.ClearContent();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename="Report.xls);
//Response.AddHeader("content-disposition", String.Format(@"attachment;filename={0}.xls", sheetName.Replace(" ", "_")));
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
SalesGrid.AllowPaging = false;
SalesQuery(Convert.ToDateTime(TxtFromDt.Text), Convert.ToDateTime(TxtToDt.Text));
SalesGrid.RenderControl(hw);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();