Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: ASP
Posted by: Mario Lopes
Added: Oct 20, 2018 5:47 PM
Views: 44
  1.  public override void VerifyRenderingInServerForm(Control control)
  2.     {
  3.         /* Verifies that the control is rendered */
  4.     }
  5.  
  6.     protected void Envia_Excel(object sender, EventArgs e)
  7.     {
  8.         Response.ClearContent();
  9.         Response.AddHeader("content-disposition", "attachment; filename=lopes.xls" );
  10.         Response.ContentType = "application/excel";
  11.         System.IO.StringWriter sw = new System.IO.StringWriter();
  12.         HtmlTextWriter htw = new HtmlTextWriter(sw);
  13.         GridView1.RenderControl(htw);
  14.         Response.Write(sw.ToString());
  15.         Response.End();
  16.     }