I have below mentioned codes
Try
If Session("UserID") = Nothing Then
DBH.SessionExpired()
Else
Dim CustomerId As Int64 = ddCustomers.SelectedValue
Dim MonthId As Integer = ddMonths.SelectedValue
Dim InvDate As Date = TxtInvoiceDate.Text
Dim TripIdList As String = ""
Dim SqlStr As String = "ViewTripsDetails '" & Session("CompanyId") & "','" & Session("FyId") & "','" & CustomerId & "','" & MonthId & "','" & TripIdList & "' "
ReportViewer1.ProcessingMode = ProcessingMode.Local
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/RptInvoice.rdlc")
Dim DataSetInv As DsInvoice = GetData(SqlStr)
Dim datasource As New ReportDataSource("InvData", DataSetInv.Tables(0))
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(datasource)
Dim warnings As Warning()
Dim streamIds As String()
Dim contentType As String
Dim encoding As String
Dim extension As String
Dim bytes As Byte() = ReportViewer1.LocalReport.Render("PDF", Nothing, contentType, encoding, extension, streamIds, warnings)
Response.Clear()
Response.Buffer = True
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = contentType
Response.AppendHeader("Content-Disposition", "attachment; filename=RDLC." & extension)
Response.BinaryWrite(bytes)
Response.Flush()
Response.End()
End If
Catch ex As Exception
msg.Text = ex.Message.ToString
DBH.ShowTstr(DBH.ToastType.Error, ex.Message.ToString, "Opps ! There is an error")
End Try
By the help of above codes I would like to generate and downlaod the pdf file from rdlc report.
but it is throwing error "Thread is abored".
Also not downlod the report in pdf form.