p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   Export DataList to Excel (http://p2p.wrox.com/showthread.php?t=54510)

rsearing February 23rd, 2007 03:31 PM

Export DataList to Excel
Can someone please help. I was able to export my Gridview to Excel, but had to use a datalist instead due to some unique bindings I had to place on the contents.

I tried simply changing "GridView" to "DataList" and it didn't work.

Please help.

Kind Regards,

Dim MyGridView As New GridView()
        'MyGridView = GridView1
        MyGridView.DataSource = KnightsDataSource
        Dim attachment As String = "attachment; filename=Members.xls"
        Response.AddHeader("content-disposition", attachment)
        Response.ContentType = "application/ms-excel"
        Dim sw As IO.StringWriter = New IO.StringWriter()
        Dim htw As HtmlTextWriter = New HtmlTextWriter(sw)

All times are GMT -4. The time now is 01:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.