S
Siva Mateti
I'm having some problems with exporting datagrid to
excel. First I had problems with Datagridlink buttons
(for paging and sorting), which I solved by iterating
through the datagrid and replacing all the link buttons
with literal control. Then I thought this following code
snippet would work:
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms- excel"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
DataGrid2.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
But after I run the snippet either nothing happens
or "page cannot be displayed" error occurs. I looked into
the process explorer and EXCEL.EXE seems to be running.
Also I turned the trace on to look at the content type and
I got "application/x-www-form-urlencoded".
Can anyone please explain me how to do it?
Thanks
Siva Mateti
excel. First I had problems with Datagridlink buttons
(for paging and sorting), which I solved by iterating
through the datagrid and replacing all the link buttons
with literal control. Then I thought this following code
snippet would work:
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms- excel"
Response.Charset = ""
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
DataGrid2.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
But after I run the snippet either nothing happens
or "page cannot be displayed" error occurs. I looked into
the process explorer and EXCEL.EXE seems to be running.
Also I turned the trace on to look at the content type and
I got "application/x-www-form-urlencoded".
Can anyone please explain me how to do it?
Thanks
Siva Mateti