Hi,
I'm trying to determine what a user did after clicking the Export button under a grid of error records. The export is to an Excel spreadsheet but before seeing that sheet, they are presented with a dialog box (Windows 7) with choices to Open, Save or Cancel.
The process of creating the Excel wb and sheet are all done in code I'm not familiar with (added by someone else) and now I'm faced with the task of trying to determine whether they actually opened or saved the data or just clicked cancel.
I need to know this so I can allow or disallow other processing.
The following code is handling the exporting process:
Private Sub ErrorsExcel()
Dim sHTTPStatusCode As String
Try
Dim dtData As WorkDS.DataImportDataTable = CType(Session("BadWorkData"), WorkDS.DataImportDataTable)
dtData.Columns.Remove("ImportID")
Dim colIndex As Integer = 0
Dim rowIndex As Integer = 0
Dim sw As StringWriter = New StringWriter()
Dim htw As HtmlTextWriter = New HtmlTextWriter(sw)
Response.ClearContent()
Dim grid As GridView = New GridView()
grid.DataSource = dtData
grid.DataBind()
grid.RenderControl(htw)
Dim sFile As String = "attachment; filename=Errors.xls"
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition", sFile)
Me.EnableViewState = False
Response.Write(sw.ToString())
Dim sTab As String = ""
sHTTPStatusCode = Response.StatusCode.ToString()
Response.End()
Catch ex As Exception
lblErrors.Text = ex.Message
Finally
If sHTTPStatusCode = "200" Then
cbIgnoreErrors.Enabled = True
End If
End Try
Reset()
End Sub
What I have tried:
After some research trying to find returned codes or status codes related to the process, I settled for sHTTPStatusCode = Response.StatusCode.ToString() and just checking to see if "200" was being returned and then using that value in the Finally section. I soon realized this didn't tell me what choice they selected and only signaled proper request completion.
So, I need to know if they selected Open/Save or cancelled.
Any help would be much appreciated.
Red.