joakman
10-27-2003, 01:21 PM
I have a aspx page with 2 frames. The left one has a menu listing of hyperlinks. When a link is clicked, the page referenced in the hyperlink is displayed in the right content window. One of the pages that is shown in the menu list on the left(and therefore displayed on the right content frame) has a button with code behind it to export the page(html code that has been loaded into a string) to excel. I have used the code posted in this forum to force the download of an excel file. That works fine.
The problem occurs after the user chooses 'Save' and the download is complete. The right-hand content frame is now 'locked up'. If you click on the menu items on the left now, the corresponding content is not displayed in the right-hand content frame.
The only way to get the frames to start behaving properly again is to either do a right click and refresh on the content frame or click on some other control on the content frame.
Here is the code I use in the button to do the export:
Dim exportstream As String
Response.BufferOutput = True
Response.Clear()
' 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)
exportstream = "<b>This is the html to export</b>"
' write the HTML to the HTMLtextwriter.
hw.Write("<HTML><HEAD>")
hw.Write("</HEAD><BODY>")
hw.Write(ExportStream)
hw.Write("</BODY></HTML>")
Response.AppendHeader("Content-Disposition", "attachment; filename=exporttest.xls")
Response.Write(tw.ToString())
Response.Flush()
Response.Clear()
Any help or ideas would be greatly appreciated. Thanks.
Jeff
The problem occurs after the user chooses 'Save' and the download is complete. The right-hand content frame is now 'locked up'. If you click on the menu items on the left now, the corresponding content is not displayed in the right-hand content frame.
The only way to get the frames to start behaving properly again is to either do a right click and refresh on the content frame or click on some other control on the content frame.
Here is the code I use in the button to do the export:
Dim exportstream As String
Response.BufferOutput = True
Response.Clear()
' 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)
exportstream = "<b>This is the html to export</b>"
' write the HTML to the HTMLtextwriter.
hw.Write("<HTML><HEAD>")
hw.Write("</HEAD><BODY>")
hw.Write(ExportStream)
hw.Write("</BODY></HTML>")
Response.AppendHeader("Content-Disposition", "attachment; filename=exporttest.xls")
Response.Write(tw.ToString())
Response.Flush()
Response.Clear()
Any help or ideas would be greatly appreciated. Thanks.
Jeff