ashutosh9910
Freshman
- Joined
- May 13, 2005
- Messages
- 44
Visual Basic:
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment; filename=UserList.xls; sheet=Sheet2")
Response.Charset = ""
Me.EnableViewState = False
Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(oStringWriter)
dgSearchResult.RenderControl(oHtmlTextWriter)
Response.Write(oStringWriter.ToString())
Response.End()
The original code I got from this very firm and I modified it to the one above.
Now the problem is with Paging Enabled, it only saves the excel file with the current page recods.
Is there a way I could go about getting all the records in the excel file without them being displayed on the DataGrid
Thanks
Ashutosh