Solved

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

Posted on 2013-12-05
4
709 Views
Last Modified: 2013-12-22
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
Comment
Question by:Lisa412
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 39704492
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
 

Accepted Solution

by:
Lisa412 earned 0 total points
ID: 39725031
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
 

Author Closing Comment

by:Lisa412
ID: 39734460
My solution allows me to open report in report viewer, not pdf
0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question