Hello all, <BR>I&#039;m trying to do something quite simple by extracting some SQL data, putting it into a dataset and then exporting it into Excel - at the click of a button, (not on page load) <BR>I have tried numerous tecniques to achieve this however none seem to work on a button event, but ALL work on Page load. eg) call database, load dataset, rendercontrol. <BR>I want to create some Excel reports by the user selecting an option in a Dropdown list and then clicking one button "display Report" <BR>EG) ON Button1 click.....<BR>If ddlItems.SelectedIndex = 0 Then<BR>GetItems("CAPB")<BR>RenderGrid()<BR>ElseIf ddlItems.SelectedIndex = 1 Then<BR>GetItems("OTHD")<BR>RenderGrid()<BR><BR>et c.....<BR><BR>here is the code to that works on load but not on click...the outcome is that the code is run through and Excel will open up in Internet Explorer BUT will display the contents of the original screen... eg) Shows Dropdown list and Button IN EXCEL... its does not display the contents of the dataset.<BR><BR>Private Sub RenderGrid(ByVal ds As System.Data.DataSet)<BR>Response.ContentType = "application/vnd.ms-excel"<BR>&#039; Remove the charset from the Content-Type header.<BR>Response.Charset = ""<BR>&#039; Turn off the view state.<BR>Me.EnableViewState = False<BR>Dim tw As New System.IO.StringWriter()<BR>Dim hw As New System.Web.UI.HtmlTextWriter(tw)<BR>&#039; Get the HTML for the control.<BR>&#039; Dim dg As New System.Web.UI.WebControls.DataGrid()<BR>dg.DataSou rce = ds.Tables("tblItems")<BR>&#039;bind the datagrid<BR>dg.DataBind()<BR>dg.RenderControl(hw)< BR>&#039; Write the HTML back to the browser.<BR>Response.Write(tw.ToString())<BR>&#039 ; End the response.<BR>Response.End()<BR>End Sub<BR><BR>any ideas. <BR>PM