[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 753
  • Last Modified:

Trying to display SSRS report with parameters from ASP.NET (VB) page

I have deployed 2 SSSRS reports to my localhost report server - one has a parameter, the other does not. When viewed through localhost/Reports, both reports are fine. For the parameterized report there is a prompt for my parameter and the report displays correctly.

Now I want to open this report from an asp page. The code works fine for the non-parameterized report.  The parameterized report, however, throws a javascript error when it hits the Refresh command and the report tries to open.  Interestingly, if I comment out the code for setting the parameter values, the report opens as it would when viewed through LocalHost/Reports but as soon as I type in the parameter, an error is thrown.

So I'm thinking the problem is not so much in the code, but perhaps some linkage between my web application and the report server, but I have no idea what to look at.

Here is the code:

Imports Microsoft.Reporting.WebForms
Public Class ReportViewer
    Inherits System.Web.UI.Page

Private Sub DisplayBlendSheet()
ReportViewer1.ServerReport.ReportServerUrl = New System.Uri("http://localhost/ReportServer")
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
ReportViewer1.ServerReport.ReportPath = "/PTS Reports/Blend Sheet"
Dim rptParams As New System.Collections.Generic.List(Of Microsoft.Reporting.WebForms.ReportParameter)
rptParams.Add(New Microsoft.Reporting.WebForms.ReportParameter("BlendID", "BN13290"))
ReportViewer1.ServerReport.SetParameters(rptParams)
ReportViewer1.ServerReport.Refresh()
End Sub
End Class

Open in new window


The error I get is not very informative (to me anyway):
JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 404

Any help would be much appreciated.
0
Lisa412
Asked:
Lisa412
  • 2
1 Solution
 
planoczCommented:
This may help; it is written in VB.net
this code will produce a pdf ssrs report.

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_26665879.html
0
 
Lisa412Author Commented:
I finally found a solution which I will share here because I hate when I find a problem just like mine without an answer!

The problem has something to do with the way the ReportViewer control is rendered in VS 2010. It goes through several postbacks in its process. So the code to set up the report and set the parameters must be prefaced by an IsPostBack check, else it just goes into an endless loop.

That's what mine was doing anyway. Now it opens fine, with or without parameters.

Now I can't get it to close properly, but I'll open a separate question for that :)

Thanks to planocz for trying to help. I really wanted to be able to use the features of the report viewer, not just create a pdf.
0
 
Lisa412Author Commented:
My solution allows me to open report in report viewer, not pdf
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now