M
Miguel Ramirez
Hello All,
When exporting from DataGrid to excel, How can I show excel results in a new
window?
I have the following code:
-------
Protected Sub BExcel_onServerClick(ByVal Sender As Object, ByVal E As
EventArgs) Handles BExcel.Click
' Excel Export code
Dim strResult As String = Request("ddlExport_Options")
' Set the content type to Excel.
Response.ContentType = "application/vnd.ms-excel"
' Remove the charset from the Content-Type header.
Response.Charset = ""
' Turn off the view state.
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
' Get the HTML for the control.
DGridResults.RenderControl(hw)
' Write the HTML back to the browser.
Response.Write(tw.ToString())
' End the response.
Response.End()
End Sub
I will appreciate any help you can provide.
Regards,
Miguel.
When exporting from DataGrid to excel, How can I show excel results in a new
window?
I have the following code:
-------
Protected Sub BExcel_onServerClick(ByVal Sender As Object, ByVal E As
EventArgs) Handles BExcel.Click
' Excel Export code
Dim strResult As String = Request("ddlExport_Options")
' Set the content type to Excel.
Response.ContentType = "application/vnd.ms-excel"
' Remove the charset from the Content-Type header.
Response.Charset = ""
' Turn off the view state.
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
' Get the HTML for the control.
DGridResults.RenderControl(hw)
' Write the HTML back to the browser.
Response.Write(tw.ToString())
' End the response.
Response.End()
End Sub
I will appreciate any help you can provide.
Regards,
Miguel.