Solved

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

Posted on 2013-12-05
4
685 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
  • 2
4 Comments
 
LVL 27

Expert Comment

by:planocz
Comment Utility
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
Comment Utility
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
Comment Utility
My solution allows me to open report in report viewer, not pdf
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I recently went through setting up a JasperReports Server using the AWS EC2 instance, and this article will cover some basic administration tasks I had to perform.
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now