private void export_to_excel()
{
try
{
//grd_detail.Visible = true;
data_grid_print.Visible = true;
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Customerlist.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
data_grid_print.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
data_grid_print.Visible = false;
//grd_detail.Visible = false;
}
catch (Exception ex)
{
}
finally
{
}
}
{
try
{
//grd_detail.Visible = true;
data_grid_print.Visible = true;
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Customerlist.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
data_grid_print.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
data_grid_print.Visible = false;
//grd_detail.Visible = false;
}
catch (Exception ex)
{
}
finally
{
}
}
02:40
|
Category:
|
0
comments
Comments ( 0 )