displays header, no data

May 19, 2009 at 11:53 AM
Edited May 19, 2009 at 11:55 AM

Hi , appologies I can see this thread mentioned a few times, but can't see the answer.

I am executing a sql statement that is updating my gridview with the right results. However when I click the exporttoexcel button, I only receive the header row.

I have inserted the following pre-export statement and the filename part works, what do I have to do to get the export to include my rows of data?


    Protected Sub ExportToExcel1_PreExport(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExportToExcel1.PreExport
        ExportToExcel1.GridViewID = "GridView1"
        GridView1.DataSourceID = "SqlDataSource1"
        ExportToExcel1.ExportFileName = "Asset Listing Report-.xls"
    End Sub

Thanks in advance for any help,