Not able to use Report Viewer costume code RRS feed

  • Question

  • I'm creating my first web application and using C# as my backend, which I haven't used in years -- trying to knock the dust off!!  Everything has been going great until I tried to use a ReportViewer that needs parameters passed in.  I've used the ReportViewer control with no issues earlier in my app -- those reports didn't require parameters.

    The latest report does require a parameter, so I thought I could just append it to the ReportPath query string:

    ReportPath="/SLC/SPV - Attendance Monthly&schoolLevel=1"

    This does not work -- it complains that it can't find the report.  If I remove the "&schoolLevel=1", it finds the report and processes it with it's default parameter, so I know all that is set up correctly.  My html looks like this:

    <rsweb:ReportViewer ID="rvFA1LI3" runat="server" 
    Font-Names="Verdana" Font-Size="8pt"
    ProcessingMode="Remote" WaitMessageFont-Names="Verdana"
    WaitMessageFont-Size="14pt" AsyncRendering="false"
    <ServerReport ReportPath="/SLC/SPV - Attendance Monthly" 
    ReportServerUrl="" /></rsweb:ReportViewer>

    This would be so much easier if I could just insert parameters here -- I've googled and googled and cannot find any examples of simply inserting parameters directly from the html code :(

    Since that doesn't seem likely to happen, I'm now trying to create my backend code to do it.  Everything I've seen basically shows creating a report parameter list, like so:

    List<ReportParameter> pr = new List<ReportParameter>();

    but I get an error telling me that the type of namespace could not be found.  My entire C# page looks like this:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    namespace Data_Monitoring_Authority.SPV
        public partial class SPV2015 : System.Web.UI.Page
            protected void Page_Load(object sender, EventArgs e)
            protected void buildReport() 
                rvFA1LI3.ServerReport.ReportPath = MyReportPathVariable;
                rvFA1LI3.ServerReport.ReportServerUrl = new Uri(MyReportServerUrlVariable);
                List<ReportParameter> reportParams = new List<ReportParameter>();
                reportParams.Add(new ReportParameter("schoolLevel", 1));

    Am I missing something pretty obvious here?  I really hope so!!

    • Moved by Caillen Monday, December 9, 2013 7:50 AM
    Friday, December 6, 2013 7:18 PM

All replies

  • Hi puffster,

    I'm moving your question to Visual Studio Report Controls forum for better responses.

    Thanks for your understanding.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 9, 2013 7:51 AM