Hello,
I am trying to save multiple reports at the same time using reportViewer.LocalReport.Render. The report that is to be saved is currently determined by an id that is stored in session. My idea is to save the first report then change the id in session,
refresh the datasource and report, then print the second report and so on. Here is an example of the code that I am trying to use:
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim bytes As Byte()
Dim path As String = "C:\3\test.pdf"
Session("ID") = 25
odsRptSource.DataBind()
reportViewer.LocalReport.Refresh()
bytes = reportViewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
Session("ID") = 50
odsRptSource.DataBind()
reportViewer.LocalReport.Refresh()
bytes += reportViewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
File.WriteAllBytes(path, bytes)
End Sub
The problem that I am running into is that the report does not seem to refresh when I include:
bytes = reportViewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
It just prints the same report over and over.
If I do not include:
bytes = reportViewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)
The report does show a new ID when I refersh.
Thanks for any help,
MxW