Problem with MyGrid.RenderControl(hw) when many data

  • Thread starter Thread starter Anniech
  • Start date Start date
A

Anniech

I want to export the datagrid to an excel file using htmltextwriter.
My coding are as follows:

Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition",
"attachment;filename=xxx.xls;")
Response.Charset = ""
Response.Buffer = False
Me.EnableViewState = False

Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)

MyGrid.RenderControl(hw)

Response.Write(tw.ToString)
Response.Flush()
Response.Close()

However, when there is a lot of data in the grid, the application gets
error "Server Application Unavailable" on the line

MyGrid.RenderControl(hw).

Is there any size limit on the htmltextwriter? Is there any method to
get around with this problem?

Please help!
Thanks a lot! :roll:
 
Hi Anniech,

Do you know these two newsgroups
<
<news://msnews.microsoft.com/microsoft.public.dotnet.framework.aspnet.datagr
idcontrol>

If I was you I would try it there (crossposted)

Cor
 
Back
Top