Sharepoint solutions

November 17, 2007

Using ReportViewer control in Sharepoint

Filed under: main — admin @ 6:31 pm

ReportViewer can be used in Sharepoint to make reports. To do this – place ReportViewer on the aspx page. Create rdlc report file to show some table data, for example table – “Name – Age”. Then link ReportPath property with rdlc file and add data source in the DataSources collection. As we fill these properties in code, then that example can be easy modified to work with different rdlc files and different table data. More over, we can use session to pass data source to the code from another page.

ReportViewer folder contains VS2005 project that demonstrate using of this control. The files MyReport.aspx and MyReport.aspx.cs must be copied to the “layouts” folder, the Report.rdlc file must be copied to the root of your application virtual directory, where web.config is. To run example – open in the browser your site URL, followed by the _layouts/Myreports.aspx. You will see the followed picture:

If the user do not have access to read from the root of your virtual directory an error will appear. To resolve this problem you must give users privilege to read rdlc files.

10 Comments

  1. We can use dynamically creating of rdlc files and use it in the report viewer.

    Comment by admin — June 26, 2008 @ 4:02 pm

  2. [...] You can specify number of report columns by type it in the url: RMReport.aspx?col=4. See the post for more information of using report viewer control in [...]

    Pingback by Sharepoint solutions » Dynamically creating report with report viewer — June 26, 2008 @ 4:10 pm

  3. Hi, I’m trying to get a “Smart Part” user control that has a report viewer on it to work in sharepoint. I’ve added my smart part (web part) to a page with the report viewer but sharepoint throws a generic error. When I remove the report viewer for the conrol my page loads fine. I’ve tried adding the assembly info to my web config file but that only causes another error in sharepoint. Any ideas?

    Comment by Morris — April 9, 2009 @ 6:04 am

  4. Hi Morris, I suggest you to set “callstack=true” and “custom error = off” in your webconfig, so you can view the description of the errors.

    Comment by admin — April 9, 2009 @ 9:16 am

  5. I get the following error when I run in Remote processing mode:

    Report Server has encountered a SharePoint error. (rsSharePointError)
    Value does not fall within the expected range.

    There is no error logging I can find to diagnose the issue. I’ve tried your suggestion in reply 4 but its a no go.

    Any clues?

    Comment by Big Joe — April 15, 2009 @ 6:10 pm

  6. Morris, I do not know what page do you use in sharepoint (application page from layout directory or not), my examples worked with application page (from layout directory) and do not used smart web part. (web parts must be marked as safe in web config, etc.)

    Comment by admin — April 20, 2009 @ 3:26 pm

  7. Hi, I’m trying to get a “Smart Part” user control that has a report viewer on it to work in sharepoint. I’ve added my smart part (web part) to a page with the report viewer but sharepoint throws a generic error. When I remove the report viewer for the conrol my page loads fine. I’ve tried adding the assembly info to my web config file but that only causes another error in sharepoint. Could u pls help me in this?

    Comment by Suresh — July 21, 2009 @ 3:47 pm

  8. Hi! I am sorry – I never use smart part. But some advices – try to get description of errors – please see my previous answer to Morris. You do not say how report viewer get data for reports in your project. It may not to have permissions to read rdl files (if you use them).

    Comment by admin — July 21, 2009 @ 11:42 pm

  9. Hi,
    I tried the above example with wss 3.0 by downloading the file and copying the files into respective folder but i am getting following error.

    Session state has been disabled for ASP.NET. The Report Viewer control requires that session state be enabled in local mode.

    I did following changes in web.config at root of virtualdirectories of wss

    But still it gives same error.

    Comment by Ajay — September 9, 2010 @ 8:55 am

  10. Hi, I fact I have used report viewer for commercial project written in sharepoint 2007 (MOSS). So I think it will work in wss 3 too. So, simply some advice: check if session state is enabled for aspx page where report viewer is.

    Comment by admin — September 9, 2010 @ 5:53 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress