Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 618
  • Last Modified:

Expand and Collapse Groups in ReportViewer in Asp.Net WebForm

I have created a report with Report Builder 3.0 running on SQL Server 2014 in native mode.  The report has grouping by a single field.  When the report is launched from the SSRS site, the grouping with +/- symbols work perfectly.  When called from a ReportViewer control embedded in an Asp.Net page, this functionality appears not to be available.  When a plus image is clicked, the page seems to re-post and display in the same state as before the click.  I am checking for PostBack in the pageload code.

Thanks.

C# code
------------------------------
protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                //Specify the report server
                ReportViewer1.
                  ServerReport.
                  ReportServerUrl =
                  new Uri(WebConfigurationManager.
                  AppSettings["ReportServerURL"]);

                //Specify the report name
                ReportViewer1.
                  ServerReport.
                  ReportPath = Session["reportPath"].ToString();

                //Specify the server credentials
                /* ReportViewer1.
                  ServerReport.
                  ReportServerCredentials =
                  new CustomReportCredentials
                   (
                     WebConfigurationManager.
                      AppSettings["ReportServerUser"],
                     WebConfigurationManager.
                      AppSettings["ReportServerPassword"],
                     WebConfigurationManager.
                      AppSettings["ReportServerDomain"]
                   );
                 */
                /*
                 * With the report specified, hydrate the report
                 * parameters based on the values in the
                 * reportParameters hash.
                 */
                if(Session["reportParameters"] != null)
                {
                    var reportParameters = (Dictionary<string, string>)Session["reportParameters"];

                    foreach (var item in reportParameters)
                    {
                        ReportViewer1.
                        ServerReport.
                        SetParameters(
                        new List<ReportParameter>()
                            {
                                new ReportParameter(item.Key, item.Value)
                            });
                    }
                }
               

            }

        }
0
MinirvaTwo
Asked:
MinirvaTwo
1 Solution
 
sammySeltzerCommented:
When I ran into similar problem a year ago, this is the solution that worked for me.

It is still correct today.

http://www.sqlchick.com/entries/2010/9/19/expand-or-collapse-all-grouped-items-on-ssrs-report.html
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now