private void ExportGridView(string Leg, GridView GV)
{
string attachment = string.Empty;
attachment = "attachment; filename=" + Leg + "Report.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
try
{
GV.RenderControl(htw);
}
catch (HttpException)
{
}
Response.Write("<h4><b>Material Stocl Ledger<b><h4>");
Response.Write(sw.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
No comments:
Post a Comment