Wednesday 1 October 2008

nowhere else that I could find it, so here for the good of man (and the odd ASP.Net developer

I have a website that I want to show reports to the users. We use Reporting Services on SQL Server 2005 and I develop the reports via Visual Studio 2005, deploying them to a normal Report Server. I would like the user to be able to view these reports via their .Net application and ideally to select the report they need from a form control (like a Drop Down List maybe?) and then see the report in the page.

So...

  • create two or more reports (we need more than one to demonstrate that the selection is working) and deploy them to your server.

  • create a stored procedure to return a list of the reports on your server
  • create an ASP.Net web page
  • drag onto the page

    • one data source (dsReportList)

    • one drop down list (ddlreportlst)

    • one reportviewer object (reportviewer1)



  • set the data source to reference the stored procedure

  • set the drop down list to reference the data source

  • set the report viewer to be

    • a server report

    • reference the report server url - the locations where the reports were deployed

    • if you want the report to have data in it then also set it to a specific report


    • edit the code behind for the SelectedIndexChanged section of the drop down list code to be:

      With ReportViewer1
         .ServerReport.ReportPath = "/vms/" & ddlReportList.SelectedItem.ToString
            .ServerReport.Refresh()
         End With



Make sure the AutoPostBack value for the Drop Down List is True so each time it is changed the page refreshes.

Should work now.

No comments:

AddThis

Bookmark and Share
 
Google Analytics Alternative