MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Passing parameters to a Report Viewer web part in MOSS

  Asked By: Raju    Date: Sep 08    Category: MOSS    Views: 4326

I have deployed the report explorer and report viewer web parts provided with SQL 2005 to my MOSS environment. However for the reports to work properly, I need to pass a parameter to them (specifically the username of the person logged in and viewing the reports). Anyone know how I might accomplish this?



1 Answer Found

Answer #1    Answered By: Ella Sargent     Answered On: Sep 08

I did already implement another solution. I'll post mine in case it helps anyone else.

The biggest problem that I was having was using the RS web  Parts provided in the install of SQL 05. The only web parts  that come with it are the RS report  Explorer and RS Report Viewer. Both are very nice, functional web parts. However, to be able to pass a parameter to the Report viewer  at the time of initialization is quite tricky. It would require designing a custom parameters  web part  that would accept a connection from the Report Explorer, then connect to the Report Viewer passing  the report name and parameter(s).

Instead of tackling that solution, I built a custom web part that will do everything in 1 web part.

First, I created a custom grid that will serve as the Report Explorer. You can configure this anyway you like, just make sure 1 column is the report path. Second, create an instance of a Report Viewer control. This is the standard .NET Report Viewer. You can create that in code, passing all parameters in code, then render the viewer control. This solution worked great for me. The parameters I needed to pass were defined prior to the report needing to be rendered. So I could pull those values prior to instantiating the viewer control.

I'm doing a write-up for my blog. I'll post the full solution there and link it here later.

Didn't find what you were looking for? Find more on Passing parameters to a Report Viewer web part in MOSS Or get search suggestion and latest updates.