Error: Subreport could not be shown

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?SGVyYg==?=

    Error: Subreport could not be shown

    I have created a report and subreport in VB/ASP.NET. The report works fine
    but the subreport will not display. The subreport, when displayed as a
    standalone report, works fine.

    Any help I can find on this error refers to the WinForms.Report Viewer and
    none to the WebForms.Report Viewer.

    Anyone have any guidance?
  • Steven Cheng[MSFT]

    #2
    RE: Error: Subreport could not be shown

    Hi Herb,

    From your description, you are using webform reportviewer to display two
    SSRS report(client or server report?) in ASP.NET web page. However, the
    main report display ok, but the subreport didn't display, correct?

    As for the Sub report, have you tried any other very simple report to see
    whether it is specific to the sub report's structure or content. Also, when
    running the report, what's the error message you get for the subreport when
    try displaying it?

    Please feel free to let me know if there is anything I missed or if you
    have any other finding on this.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    =============== =============== =============== =====

    Get notification to my posts through email? Please refer to
    Gain technical skills through documentation and training, earn certifications and connect with the community

    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscripti...t/default.aspx.

    =============== =============== =============== =====



    This posting is provided "AS IS" with no warranties, and confers no rights.



    Comment

    • =?Utf-8?B?SGVyYg==?=

      #3
      RE: Error: Subreport could not be shown

      I have 1 .aspx form which contains 1 Webforms.Report Viewer object. The
      LocalReport.Rep ortPath is to my REPORT1.rdlc

      REPORT1.rdlc has a subreport with a ReportName of SUBREPORT1

      There are no parameters passed between report and subreport.

      When I run this, I get the "Subreport could not be shown" error.

      If I add a second WebForms.Report Viewer to my .aspx form and link it to
      SUBREPORT1.rdlc , it works fine.

      "Steven Cheng[MSFT]" wrote:
      Hi Herb,
      >
      From your description, you are using webform reportviewer to display two
      SSRS report(client or server report?) in ASP.NET web page. However, the
      main report display ok, but the subreport didn't display, correct?
      >
      As for the Sub report, have you tried any other very simple report to see
      whether it is specific to the sub report's structure or content. Also, when
      running the report, what's the error message you get for the subreport when
      try displaying it?
      >
      Please feel free to let me know if there is anything I missed or if you
      have any other finding on this.
      >
      Sincerely,
      >
      Steven Cheng
      >
      Microsoft MSDN Online Support Lead
      >
      >
      >
      =============== =============== =============== =====
      >
      Get notification to my posts through email? Please refer to
      Gain technical skills through documentation and training, earn certifications and connect with the community

      ications.
      >
      >
      >
      Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
      where an initial response from the community or a Microsoft Support
      Engineer within 1 business day is acceptable. Please note that each follow
      up response may take approximately 2 business days as the support
      professional working with you may need further investigation to reach the
      most efficient resolution. The offering is not appropriate for situations
      that require urgent, real-time or phone-based interactions or complex
      project analysis and dump analysis issues. Issues of this nature are best
      handled working with a dedicated Microsoft Support Engineer by contacting
      Microsoft Customer Support Services (CSS) at
      http://msdn.microsoft.com/subscripti...t/default.aspx.
      >
      =============== =============== =============== =====
      >
      >
      >
      This posting is provided "AS IS" with no warranties, and confers no rights.
      >
      >
      >
      >

      Comment

      • =?Utf-8?B?SGVyYg==?=

        #4
        RE: Error: Subreport could not be shown

        Additionally, when I link a very simple subreport (text only), it works.

        My SUBREPORT1.rdlc refers to a data source and uses a SESSION variable for
        it's criteria. Must it use a parameter from the main report?

        "Herb" wrote:
        I have 1 .aspx form which contains 1 Webforms.Report Viewer object. The
        LocalReport.Rep ortPath is to my REPORT1.rdlc
        >
        REPORT1.rdlc has a subreport with a ReportName of SUBREPORT1
        >
        There are no parameters passed between report and subreport.
        >
        When I run this, I get the "Subreport could not be shown" error.
        >
        If I add a second WebForms.Report Viewer to my .aspx form and link it to
        SUBREPORT1.rdlc , it works fine.
        >
        "Steven Cheng[MSFT]" wrote:
        >
        Hi Herb,

        From your description, you are using webform reportviewer to display two
        SSRS report(client or server report?) in ASP.NET web page. However, the
        main report display ok, but the subreport didn't display, correct?

        As for the Sub report, have you tried any other very simple report to see
        whether it is specific to the sub report's structure or content. Also, when
        running the report, what's the error message you get for the subreport when
        try displaying it?

        Please feel free to let me know if there is anything I missed or if you
        have any other finding on this.

        Sincerely,

        Steven Cheng

        Microsoft MSDN Online Support Lead



        =============== =============== =============== =====

        Get notification to my posts through email? Please refer to
        Gain technical skills through documentation and training, earn certifications and connect with the community

        ications.



        Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
        where an initial response from the community or a Microsoft Support
        Engineer within 1 business day is acceptable. Please note that each follow
        up response may take approximately 2 business days as the support
        professional working with you may need further investigation to reach the
        most efficient resolution. The offering is not appropriate for situations
        that require urgent, real-time or phone-based interactions or complex
        project analysis and dump analysis issues. Issues of this nature are best
        handled working with a dedicated Microsoft Support Engineer by contacting
        Microsoft Customer Support Services (CSS) at
        http://msdn.microsoft.com/subscripti...t/default.aspx.

        =============== =============== =============== =====



        This posting is provided "AS IS" with no warranties, and confers no rights.


        Comment

        • Steven Cheng[MSFT]

          #5
          RE: Error: Subreport could not be shown

          Hi Herb,

          I've performed some local tests and also found the problem when I use a
          subreport that bind with some datasources. And after some further research,
          I found an existing issue, this is due to the subreport also need to define
          its datasource in the main report's page. Actually, both the main report
          and subreport will look for datasource/dataset from the hosting aspx
          page(where the reportviewer reside). Do you think this is the cause of your
          problem. If so , here is a solution to it:

          *** Problem Description ***
          If you show a report with a subreport in the ReportViewer control and the
          ReportViewer control is set to "local", you will get these error messages:

          in the VS output window: Warning: An error occurred while executing the
          subreport
          'subreport1': An error has occurred during report processing.
          (rsErrorExecuti ngSubreport)

          in the ReportViewer, we get the message: Error: Subreport could not be shown

          <><><><><><><>< ><><><><><><><> <><><><><><><>< ><><><><><><><> <><><><><><><>< >
          <>
          *** Resolution ***
          In the form that contains the ReportViewer control, you must add an event
          handler.
          In that event handler, you must manually bind the subreport datasource:
          --------------------------------------------------------
          Private Sub Local_Load(ByVa l sender As System.Object, ByVal e As
          System.EventArg s) Handles MyBase.Load
          'TODO: This line of code loads data into the
          'AdventureWorks DataSet.Contact ' table. You can move, or remove it, as
          needed.
          Me.ContactTable Adapter.Fill(Me .AdventureWorks DataSet.Contact )

          Dim instance As LocalReport = Me.ReportViewer 1.LocalReport


          AddHandler ReportViewer1.L ocalReport.Subr eportProcessing , AddressOf
          Me.SetSubDataSo urce

          Me.ReportViewer 1.RefreshReport ()
          End Sub

          Public Sub SetSubDataSourc e(ByVal sender As Object, ByVal e As
          SubreportProces singEventArgs)

          e.DataSources.A dd(New ReportDataSourc e("AdventureWor ksDataSet_Conta ct",
          Me.AdventureWor ksDataSet.Conta ct))


          End Sub
          --------------------------------------------------------

          The table name is derived from the table adapter and the data source name
          must be
          copied from the report's datasources.
          =============== =============== ====

          Hope this helps.

          Sincerely,

          Steven Cheng

          Microsoft MSDN Online Support Lead


          This posting is provided "AS IS" with no warranties, and confers no rights.

          Comment

          • =?Utf-8?B?SGVyYg==?=

            #6
            RE: Error: Subreport could not be shown

            I think you will find this example is for the Winforms.Report Viewer, not the
            Webforms.Report Viewer. There is no .RefreshReport for the webforms version.
            Did you try this in a web application? I was unable to get this to work in a
            web application.

            "Steven Cheng[MSFT]" wrote:
            Hi Herb,
            >
            I've performed some local tests and also found the problem when I use a
            subreport that bind with some datasources. And after some further research,
            I found an existing issue, this is due to the subreport also need to define
            its datasource in the main report's page. Actually, both the main report
            and subreport will look for datasource/dataset from the hosting aspx
            page(where the reportviewer reside). Do you think this is the cause of your
            problem. If so , here is a solution to it:
            >
            *** Problem Description ***
            If you show a report with a subreport in the ReportViewer control and the
            ReportViewer control is set to "local", you will get these error messages:
            >
            in the VS output window: Warning: An error occurred while executing the
            subreport
            'subreport1': An error has occurred during report processing.
            (rsErrorExecuti ngSubreport)
            >
            in the ReportViewer, we get the message: Error: Subreport could not be shown
            >
            <><><><><><><>< ><><><><><><><> <><><><><><><>< ><><><><><><><> <><><><><><><>< >
            <>
            *** Resolution ***
            In the form that contains the ReportViewer control, you must add an event
            handler.
            In that event handler, you must manually bind the subreport datasource:
            --------------------------------------------------------
            Private Sub Local_Load(ByVa l sender As System.Object, ByVal e As
            System.EventArg s) Handles MyBase.Load
            'TODO: This line of code loads data into the
            'AdventureWorks DataSet.Contact ' table. You can move, or remove it, as
            needed.
            Me.ContactTable Adapter.Fill(Me .AdventureWorks DataSet.Contact )
            >
            Dim instance As LocalReport = Me.ReportViewer 1.LocalReport
            >
            >
            AddHandler ReportViewer1.L ocalReport.Subr eportProcessing , AddressOf
            Me.SetSubDataSo urce
            >
            Me.ReportViewer 1.RefreshReport ()
            End Sub
            >
            Public Sub SetSubDataSourc e(ByVal sender As Object, ByVal e As
            SubreportProces singEventArgs)
            >
            e.DataSources.A dd(New ReportDataSourc e("AdventureWor ksDataSet_Conta ct",
            Me.AdventureWor ksDataSet.Conta ct))
            >
            >
            End Sub
            --------------------------------------------------------
            >
            The table name is derived from the table adapter and the data source name
            must be
            copied from the report's datasources.
            =============== =============== ====
            >
            Hope this helps.
            >
            Sincerely,
            >
            Steven Cheng
            >
            Microsoft MSDN Online Support Lead
            >
            >
            This posting is provided "AS IS" with no warranties, and confers no rights.
            >
            >

            Comment

            • Steven Cheng[MSFT]

              #7
              RE: Error: Subreport could not be shown

              Thanks for your reply Herb,

              Yes, the original issue record is for a winform reportviewer issue,
              however, it also applies to webform scenario. And I did change the code in
              my local test page, but forgot to modify it when paste the original code
              snippet to you. Here is the test code in my test page:

              (you need two datasources on the page, one for your main report and another
              for the subreport)
              =============== ============
              public partial class test_reportpage : System.Web.UI.P age
              {
              protected void Page_Load(objec t sender, EventArgs e)
              {
              ReportViewer1.L ocalReport.Subr eportProcessing += new
              SubreportProces singEventHandle r(SetSubDataSou rce);
              this.ReportView er1.LocalReport .Refresh();
              }

              public void SetSubDataSourc e(object sender,
              SubreportProces singEventArgs e )
              {
              e.DataSources.A dd(new ReportDataSourc e("DataSet1_rpt _table",
              "ObjectDataSour ce1"));

              }
              }
              =============== ==============

              Sincerely,

              Steven Cheng

              Microsoft MSDN Online Support Lead


              This posting is provided "AS IS" with no warranties, and confers no rights.

              Comment

              • =?Utf-8?B?SGVyYg==?=

                #8
                RE: Error: Subreport could not be shown

                Steven,

                My ReportViewer1.L ocalReport does not include a SubreportProces sing command.

                If you could provide VB examples, I would appreciate it.

                "Steven Cheng[MSFT]" wrote:
                Thanks for your reply Herb,
                >
                Yes, the original issue record is for a winform reportviewer issue,
                however, it also applies to webform scenario. And I did change the code in
                my local test page, but forgot to modify it when paste the original code
                snippet to you. Here is the test code in my test page:
                >
                (you need two datasources on the page, one for your main report and another
                for the subreport)
                =============== ============
                public partial class test_reportpage : System.Web.UI.P age
                {
                protected void Page_Load(objec t sender, EventArgs e)
                {
                ReportViewer1.L ocalReport.Subr eportProcessing += new
                SubreportProces singEventHandle r(SetSubDataSou rce);
                this.ReportView er1.LocalReport .Refresh();
                }
                >
                public void SetSubDataSourc e(object sender,
                SubreportProces singEventArgs e )
                {
                e.DataSources.A dd(new ReportDataSourc e("DataSet1_rpt _table",
                "ObjectDataSour ce1"));
                >
                }
                }
                =============== ==============
                >
                Sincerely,
                >
                Steven Cheng
                >
                Microsoft MSDN Online Support Lead
                >
                >
                This posting is provided "AS IS" with no warranties, and confers no rights.
                >
                >

                Comment

                • Steven Cheng[MSFT]

                  #9
                  RE: Error: Subreport could not be shown

                  Thanks for your reply Herb,

                  For VB.NET page, you can directly type the
                  "reportViewer.L ocalReport.SubR eportProcessing " event regardless of the
                  intellisense support. Here is the converted VB.NET version of my test
                  page's codebehind:

                  =============== ==========
                  Imports Microsoft.Repor ting.WebForms

                  Partial Class vb_vbreportpage
                  Inherits System.Web.UI.P age

                  Protected Sub Page_Load(ByVal sender As Object, ByVal e As
                  System.EventArg s) Handles Me.Load
                  AddHandler ReportViewer1.L ocalReport.Subr eportProcessing , AddressOf
                  SetSubDataSourc e
                  ReportViewer1.L ocalReport.Refr esh()

                  End Sub


                  Public Sub SetSubDataSourc e(ByVal sender As Object, ByVal e As
                  SubreportProces singEventArgs)

                  e.DataSources.A dd(New ReportDataSourc e("DataSet1_rpt _table",
                  "ObjectDataSour ce1"))

                  End Sub

                  End Class
                  =============== =============

                  Hope this helps.

                  Sincerely,

                  Steven Cheng

                  Microsoft MSDN Online Support Lead


                  This posting is provided "AS IS" with no warranties, and confers no rights.

                  Comment

                  • =?Utf-8?B?SGVyYg==?=

                    #10
                    RE: Error: Subreport could not be shown

                    Thanks for the reply, sorry I have been away fromthis project for a while and
                    some of this has slipped my mind. When you refer to:
                    e.DataSources.A dd(New ReportDataSourc e ("DataSet1_rpt_ table",
                    "ObjectDataSour ce1"))
                    what is meant by the ObjectDataSourc e1? I understand the DataSet1_rpt_ta ble
                    is the dataset of the subreport. Is the ObjectDataSourc e1 the view which the
                    dataset refers to?

                    "Steven Cheng[MSFT]" wrote:
                    Thanks for your reply Herb,
                    >
                    For VB.NET page, you can directly type the
                    "reportViewer.L ocalReport.SubR eportProcessing " event regardless of the
                    intellisense support. Here is the converted VB.NET version of my test
                    page's codebehind:
                    >
                    =============== ==========
                    Imports Microsoft.Repor ting.WebForms
                    >
                    Partial Class vb_vbreportpage
                    Inherits System.Web.UI.P age
                    >
                    Protected Sub Page_Load(ByVal sender As Object, ByVal e As
                    System.EventArg s) Handles Me.Load
                    AddHandler ReportViewer1.L ocalReport.Subr eportProcessing , AddressOf
                    SetSubDataSourc e
                    ReportViewer1.L ocalReport.Refr esh()
                    >
                    End Sub
                    >
                    >
                    Public Sub SetSubDataSourc e(ByVal sender As Object, ByVal e As
                    SubreportProces singEventArgs)
                    >
                    e.DataSources.A dd(New ReportDataSourc e("DataSet1_rpt _table",
                    "ObjectDataSour ce1"))
                    >
                    End Sub
                    >
                    End Class
                    =============== =============
                    >
                    Hope this helps.
                    >
                    Sincerely,
                    >
                    Steven Cheng
                    >
                    Microsoft MSDN Online Support Lead
                    >
                    >
                    This posting is provided "AS IS" with no warranties, and confers no rights.
                    >
                    >

                    Comment

                    • Steven Cheng[MSFT]

                      #11
                      RE: Error: Subreport could not be shown

                      Hi Herb,

                      The "ObjectDataSour ce1" is the ID of a ObjectDataSourc e control which
                      supply the datasource(Data Set) for the report(displaye d in ReportViewer).
                      Actually in Visual Studio 2005 designer, when you choose a client rdlc
                      report in the ReportViewer, it will automatically generate an
                      ObjectDataSourc e control in aspx page for you. However, here since you use
                      subreport, you need to manually add an ObjectDataSourc e control that can
                      supply dataset for your subreport. However, one trick to add such a
                      ObjectDataSourc e is add another ReportViewer that display the subreport
                      individually, and it can automatically help you generate such a DataSource
                      control. After that you can remove the temp reportViewer and keep the
                      ObjectDataSourc e and use it for the first ReportViewer (that use sub
                      report).

                      Sincerely,

                      Steven Cheng

                      Microsoft MSDN Online Support Lead


                      This posting is provided "AS IS" with no warranties, and confers no rights.

                      Comment

                      • Steven Cheng[MSFT]

                        #12
                        RE: Error: Subreport could not be shown

                        Hi Herb,

                        Have you got any progress? Does the further info in my last reply also
                        helps some?

                        Sincerely,

                        Steven Cheng

                        Microsoft MSDN Online Support Lead


                        This posting is provided "AS IS" with no warranties, and confers no rights.

                        Comment

                        • =?Utf-8?B?SGVyYg==?=

                          #13
                          RE: Error: Subreport could not be shown

                          Steven,
                          Sorry, I have been having some PC issues. I will test this by Monday and get
                          back to you.

                          Thanks,
                          Herb

                          "Steven Cheng[MSFT]" wrote:
                          Hi Herb,
                          >
                          Have you got any progress? Does the further info in my last reply also
                          helps some?
                          >
                          Sincerely,
                          >
                          Steven Cheng
                          >
                          Microsoft MSDN Online Support Lead
                          >
                          >
                          This posting is provided "AS IS" with no warranties, and confers no rights.
                          >
                          >

                          Comment

                          • =?Utf-8?B?SGVyYg==?=

                            #14
                            RE: Error: Subreport could not be shown

                            Steven,
                            That worked great, thank you!

                            Next question. I need to add ANOTHER subreport to this report. Is that
                            possible? Should I close this topic and start a new question?

                            Thanks

                            "Steven Cheng[MSFT]" wrote:
                            Hi Herb,
                            >
                            Have you got any progress? Does the further info in my last reply also
                            helps some?
                            >
                            Sincerely,
                            >
                            Steven Cheng
                            >
                            Microsoft MSDN Online Support Lead
                            >
                            >
                            This posting is provided "AS IS" with no warranties, and confers no rights.
                            >
                            >

                            Comment

                            • =?Utf-8?B?SGVyYg==?=

                              #15
                              RE: Error: Subreport could not be shown

                              Forget I asked. I found that adding a second event handler did the trick.
                              Thanks a lot for your help.

                              "Herb" wrote:
                              Steven,
                              That worked great, thank you!
                              >
                              Next question. I need to add ANOTHER subreport to this report. Is that
                              possible? Should I close this topic and start a new question?
                              >
                              Thanks
                              >
                              "Steven Cheng[MSFT]" wrote:
                              >
                              Hi Herb,

                              Have you got any progress? Does the further info in my last reply also
                              helps some?

                              Sincerely,

                              Steven Cheng

                              Microsoft MSDN Online Support Lead


                              This posting is provided "AS IS" with no warranties, and confers no rights.

                              Comment

                              Working...