locked
Can I keep ReportViewer from rendering until I call on it? RRS feed

  • Question

  • I'm creating a web app in C# using HTML 5 that is going to have dozens of reports being rendered in it.  I'm using bootstrap accordian, and initially all the reports are going to start out "hidden".  Right now I've got 6 of the reports set up, and I'm already seeing performance hits from all the reports trying to be built.  Is there a way to not have these reports rendered until they become visible, or looking at my code below, am I just doing something incorrectly?

    My .aspx looks like this below...

                                                            <div class="container">
                                                                <div class="row">
                                                                    <div class="span4 collapse-group">
                                                                        <a id="btnFA1LI3All" class="btn btn-info" data-toggle="collapse" data-target="#rvFA1LI3All">
                                                                            All</a> <a id="btnFA1LI3High" class="btn btn-info" data-toggle="collapse" data-target="#rvFA1LI3High">
                                                                                High</a> <a id="btnFA1LI3Middle" class="btn btn-info" data-toggle="collapse" data-target="#rvFA1LI3Middle">
                                                                                    Middle</a> <a id="btnFA1LI3Elem" class="btn btn-info" data-toggle="collapse" data-target="#rvFA1LI3Elem">
                                                                                        Elem</a>
                                                                        <p>
                                                                            <rsweb:ReportViewer ID="rvFA1LI3All" runat="server" CssClass="collapse" Font-Names="Verdana"
                                                                                Font-Size="8pt" ProcessingMode="Remote" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" 
                                                                                AsyncRendering="true" SizeToReportContent="true" OnInit="buildReport">
                                                                                <ServerReport ReportPath="/SLC/SPV - Attendance Monthly" ReportServerUrl="https://reports.jefferson.kyschools.us/reportserver" />
                                                                            </rsweb:reportviewer>
                                                                        </p>
                                                                        <p>
                                                                            <rsweb:ReportViewer ID="rvFA1LI3High" runat="server" CssClass="collapse" Font-Names="Verdana"
                                                                                Font-Size="8pt" ProcessingMode="Remote" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" 
                                                                                AsyncRendering="true" SizeToReportContent="true" OnInit="buildReport">
                                                                                <ServerReport ReportPath="/SLC/SPV - Attendance Monthly" ReportServerUrl="https://reports.jefferson.kyschools.us/reportserver" />
                                                                            </rsweb:reportviewer>
                                                                        </p>
                                                                        <p>
                                                                            <rsweb:ReportViewer ID="rvFA1LI3Middle" runat="server" CssClass="collapse" Font-Names="Verdana"
                                                                                Font-Size="8pt" ProcessingMode="Remote" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" 
                                                                                AsyncRendering="true" SizeToReportContent="true" OnInit="buildReport">
                                                                                <ServerReport ReportPath="/SLC/SPV - Attendance Monthly" ReportServerUrl="https://reports.jefferson.kyschools.us/reportserver" />
                                                                            </rsweb:reportviewer>
                                                                        </p>
                                                                        <p>
                                                                            <rsweb:ReportViewer ID="rvFA1LI3Elem" runat="server" CssClass="collapse" Font-Names="Verdana"
                                                                                Font-Size="8pt" ProcessingMode="Remote" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" 
                                                                                AsyncRendering="true" SizeToReportContent="true" OnInit="buildReport">
                                                                                <ServerReport ReportPath="/SLC/SPV - Attendance Monthly" ReportServerUrl="https://reports.jefferson.kyschools.us/reportserver" />
                                                                            </rsweb:reportviewer>
                                                                        </p>
                                                                    </div>
                                                                </div>
                                                            </div>
    

    The codebehind proc that it is calling looks like this:

            protected void buildReport(object sender, EventArgs e)
            {
                ReportViewer rv = (ReportViewer)sender;
                ReportParameter[] prm = new ReportParameter[1];
    
                prm[0] = new ReportParameter();
                prm[0].Name = "schoolLevel";
    
                switch (rv.ClientID)
                {
                    case "rvFA1LI3High":
                        prm[0].Values.Add("03");
                        break;
    
                    case "rvFA1LI3Middle":
                        prm[0].Values.Add("02");
                        break;
    
                    case "rvFA1LI3Elem":
                        prm[0].Values.Add("01");
                        break;
    
                    default:
                        prm[0].Values.Add("*");
                        break;
                }
    
                prm[0].Visible = true;
    
                rv.ServerReport.SetParameters(prm);
            }
    

    Below are a couple of screenshots of what this web app looks like in it's initial state, and when it's drilled down to the report level...

    Thursday, January 2, 2014 5:20 PM