Response.BinaryWrite with showModalDialogBox

ashutosh9910

Freshman
Joined
May 13, 2005
Messages
44
Hi all,

I am facing trouble with using Response.BinaryWrite.


Visual Basic:
Private Sub lnkCustomerData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkCustomerData.Click
        Dim ds As DataSet
        Dim objService As New AMSInternalUserService.AMSInternalUserService
        Dim lngReportFileId As Long
        lngReportFileId = lstPrevUpload.SelectedItem.Value
        ds = objService.GetReportFileDetails(lngReportFileId)
        If ds.Tables(0).Rows.Count > 0 Then
            Dim strFileExt, strFileName As String
            strFileName = ds.Tables(0).Rows(0).Item("ReportCustomerFileName")
            If InStr(strFileName, ".") > 0 Then
                strFileExt = Mid(strFileName, InStr(strFileName, "."), Len(strFileName))
                Select Case LCase(strFileExt)
                    Case ".xls"
                        Response.ContentType = "application/x-msexcel"
                    Case ".doc"
                        Response.ContentType = "application/msword"
                    Case ".txt"
                        Response.ContentType = "text/plain"
                    Case ".ppt"
                        Response.ContentType = "application/vnd.ms-p"
                    Case ".pdf"
                        Response.ContentType = "application/pdf"
                End Select

                Response.AddHeader("content-disposition", "attachment; filename=" + ds.Tables(0).Rows(0).Item("ReportCustomerFileName"))
                If Not IsDBNull(ds.Tables(0).Rows(0)("ReportFileCustomer")) Then
                    Response.BinaryWrite(ds.Tables(0).Rows(0)("ReportFileCustomer"))
                End If
                Response.End()
            End If
        End If

This is the code I use to download a file on the Link Button click.

Now the trouble is that this link button is placed on a form which is invoked through

window.showModalDialogBox method.

While debugging there is no error and everything goes fine, each and every line of code is executed perfectly but the popup does not appear.

Any help is greatly appreciated.


Thanks
Ashutosh
 
Back
Top