Protected Sub ExportAsExcel_Click(sender As Object, e As EventArgs) Handles ExportAsExcel.ClickResponse.Clear() Response.Buffer = True Response.AddHeader("content-disposition", "attachment;filename=Export.xls") Response.Charset = "" Response.ContentType = "application/vnd.ms-excel" Using sw As New StringWriter() Dim hw As New HtmlTextWriter(sw) GridView1.RenderControl(hw) Dim style As String = "" Response.Write(style) Response.Output.Write(sw.ToString()) Response.Flush() Response.End() End Using End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)