Wednesday, April 16, 2008
Export GridView To Excel :
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
Response.Charset = String.Empty
Response.ContentType = "application/vnd.xls"
Dim sw As System.IO.StringWriter = New System.IO.StringWriter()
Dim hw As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(sw)
GridView1.RenderControl(hw)
Response.Write(sw.ToString())
Response.End()
End Sub
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment