473,508 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ReportViewer and
none to the WebForms.ReportViewer.

Anyone have any guidance?
May 24 '07 #1
17 20307
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
http://msdn.microsoft.com/subscripti...ult.aspx#notif
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.

May 25 '07 #2
I have 1 .aspx form which contains 1 Webforms.ReportViewer object. The
LocalReport.ReportPath 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.ReportViewer 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
http://msdn.microsoft.com/subscripti...ult.aspx#notif
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.

May 25 '07 #3
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.ReportViewer object. The
LocalReport.ReportPath 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.ReportViewer 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
http://msdn.microsoft.com/subscripti...ult.aspx#notif
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.


May 25 '07 #4
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.
(rsErrorExecutingSubreport)

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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the
'AdventureWorksDataSet.Contact' table. You can move, or remove it, as
needed.
Me.ContactTableAdapter.Fill(Me.AdventureWorksDataS et.Contact)

Dim instance As LocalReport = Me.ReportViewer1.LocalReport
AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf
Me.SetSubDataSource

Me.ReportViewer1.RefreshReport()
End Sub

Public Sub SetSubDataSource(ByVal sender As Object, ByVal e As
SubreportProcessingEventArgs)

e.DataSources.Add(New ReportDataSource("AdventureWorksDataSet_Contact",
Me.AdventureWorksDataSet.Contact))
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.

May 29 '07 #5
I think you will find this example is for the Winforms.ReportViewer, not the
Webforms.ReportViewer. 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.
(rsErrorExecutingSubreport)

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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the
'AdventureWorksDataSet.Contact' table. You can move, or remove it, as
needed.
Me.ContactTableAdapter.Fill(Me.AdventureWorksDataS et.Contact)

Dim instance As LocalReport = Me.ReportViewer1.LocalReport
AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf
Me.SetSubDataSource

Me.ReportViewer1.RefreshReport()
End Sub

Public Sub SetSubDataSource(ByVal sender As Object, ByVal e As
SubreportProcessingEventArgs)

e.DataSources.Add(New ReportDataSource("AdventureWorksDataSet_Contact",
Me.AdventureWorksDataSet.Contact))
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.

May 29 '07 #6
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.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ReportViewer1.LocalReport.SubreportProcessing += new
SubreportProcessingEventHandler(SetSubDataSource);
this.ReportViewer1.LocalReport.Refresh();
}

public void SetSubDataSource(object sender,
SubreportProcessingEventArgs e )
{
e.DataSources.Add(new ReportDataSource("DataSet1_rpt_table",
"ObjectDataSource1"));

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

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

May 31 '07 #7
Steven,

My ReportViewer1.LocalReport does not include a SubreportProcessing 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.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ReportViewer1.LocalReport.SubreportProcessing += new
SubreportProcessingEventHandler(SetSubDataSource);
this.ReportViewer1.LocalReport.Refresh();
}

public void SetSubDataSource(object sender,
SubreportProcessingEventArgs e )
{
e.DataSources.Add(new ReportDataSource("DataSet1_rpt_table",
"ObjectDataSource1"));

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

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 4 '07 #8
Thanks for your reply Herb,

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

=========================
Imports Microsoft.Reporting.WebForms

Partial Class vb_vbreportpage
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf
SetSubDataSource
ReportViewer1.LocalReport.Refresh()

End Sub
Public Sub SetSubDataSource(ByVal sender As Object, ByVal e As
SubreportProcessingEventArgs)

e.DataSources.Add(New ReportDataSource("DataSet1_rpt_table",
"ObjectDataSource1"))

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.

Jun 6 '07 #9
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.Add(New ReportDataSource ("DataSet1_rpt_table",
"ObjectDataSource1"))
what is meant by the ObjectDataSource1? I understand the DataSet1_rpt_table
is the dataset of the subreport. Is the ObjectDataSource1 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.LocalReport.SubReportProcessing" event regardless of the
intellisense support. Here is the converted VB.NET version of my test
page's codebehind:

=========================
Imports Microsoft.Reporting.WebForms

Partial Class vb_vbreportpage
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
AddHandler ReportViewer1.LocalReport.SubreportProcessing, AddressOf
SetSubDataSource
ReportViewer1.LocalReport.Refresh()

End Sub
Public Sub SetSubDataSource(ByVal sender As Object, ByVal e As
SubreportProcessingEventArgs)

e.DataSources.Add(New ReportDataSource("DataSet1_rpt_table",
"ObjectDataSource1"))

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.

Jun 8 '07 #10
Hi Herb,

The "ObjectDataSource1" is the ID of a ObjectDataSource control which
supply the datasource(DataSet) for the report(displayed in ReportViewer).
Actually in Visual Studio 2005 designer, when you choose a client rdlc
report in the ReportViewer, it will automatically generate an
ObjectDataSource control in aspx page for you. However, here since you use
subreport, you need to manually add an ObjectDataSource control that can
supply dataset for your subreport. However, one trick to add such a
ObjectDataSource 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
ObjectDataSource 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.

Jun 11 '07 #11
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.

Jun 13 '07 #12
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.

Jun 14 '07 #13
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.

Jun 14 '07 #14
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.
Jun 14 '07 #15
Thanks for your followup Herb,

Glad that you've got it working.

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 17 '07 #16
Hi Steven or Herb (or anyone),

I followed this discussion carefully - it seems to match my situation
very closely, but I did not get the success that Herb did at the end.

I'm working in Visual Web Developer 2005, using ASP.NET and VB 2005.

I am trying to create a report with a sub-report.

I first got a basic main report going - created a dataset based on
a simple query, and have no problem generating simple reports using
the ReportViewer control and a corresponding ObjectDataSource that
refers to the dataset tableadapter.

Next I created a "static" subreport (just to try walking before
crawling!). It does not depend on any dataset - it just provides
some static text. I include that as a sub-report in my main report
and it works fine.

Next I created a new dataset for the "real" sub-report. It takes a
single parameter - the key field from the "main" dataset. The aim is
that, when coupled with the main report, it will return the related
records in the sub-dataset for each record in the main report/dataset.
I test this sub-report by hard-coding a default value for the
parameter and it works fine as a stand-alone report, displaying the
correct related records from the sub-dataset for the hard-coded
parameter key value.

So... the last step is to put the sub-report into the main report. I
drop a subreport control into the main report's list control just
like I did with the static sub-report, right-click on it to open
the Properties dialog, choose the "real" sub-report (not the static
one this time) in the General tab, and finally set the parameter on
the Parameters tab (parameter name is SiteID, parameter value is
set from the drop-down to =Fields!SiteID.Value). This was my first
attempt and I thought it would be sufficient, but instead of getting
the sub-reports I get the error message:

Error: Subreport could not be shown.

That's when I found your recent discussion, and I tried what seemed to
be the 2 key issues in the solution: (1) adding some code-behind to
set the sub-datasource in the processingevent handler, and (2) adding
an <asp:ObjectDataSourcefor the sub-dataset to the aspx page. Having
done both of those, the error remains.

I set a breakpoint in the SetSubDataSource() handler - it never
fires, so I infer that the SubreportProcessing event is not being
raised(?).

I'm sure the devil is in the details, and I can provide those to
you as we go - this message is already too long, so I'll leave it
here for now and hope to hear from one of you soon... Thanks in
advance!

Chris

*** Sent via Developersdex http://www.developersdex.com ***
Jun 21 '07 #17
This Worked for me. Try this
I Created a Main report with a subreport which takes one parameter from
the Main Report. I Added the following code.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
AddHandler rvReport.LocalReport.SubreportProcessing,
AddressOf SetSubDataSource
rvReport.LocalReport.Refresh()
End Sub

Public Sub SetSubDataSource(ByVal sender As Object, ByVal e As
SubreportProcessingEventArgs)
e.DataSources.Add(New ReportDataSource("SubReport",
"ObjectDataSourceSubReport"))

ObjectDataSourceSubReport.SelectParameters("SubRep ortID").DefaultValue =
e.Parameters("SubReportID").Values(0)
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2607
by: Benny Ng | last post by:
Hi,All, When i deploy Enterprise library with my application ,i used XCOPY to deploy it into my test server. But when application runs, shown some error related registry. (But actually I haven't...
1
4734
by: Jéjé | last post by:
Hi, When I try to display a report with a subreport using the reportviewer control, I receive this error: Error: Subreport could not be shown. I have 1 paraneter between my 2 reports...
3
1713
by: MilanB | last post by:
Hello I have C# code that normaly throw exception and error message is shown. It's works fine. Separatlely I have ATL Component. When ATL Componenet fires event, and later C# code is called,...
3
35615
by: KimberlyLord | last post by:
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. But when viewed as a...
0
1464
by: pavankumarganesuni | last post by:
Hello Iam Facing a Problem While Creating Subreports In RDLC I Create A New Phyical DataSet For the Sub Report And I Bind It To the SubReport The Dataset Having Values Then the subreport is...
0
1539
by: biswajitkundu2007 | last post by:
How to implement subreport in vb.net RDLC report?? I have the following code but it gives the error :-error subreport could not be shown Private orderDetailsData As DataTable = Nothing ...
2
2897
by: Dean Slindee | last post by:
With VS2005/Vista using the ReportViewer control, on my development PC I have a report with an embedded subreport. The report/subreport runs fine in VS test as well as ClickOnce deployed on the...
0
932
by: Manikandan Pushkaran | last post by:
Dear All I made a Header Report and a Detail report, the detail report having a report parameter, the header report am refreshing with a value when we select a value from the drop down and...
1
1441
by: puneetmca | last post by:
hi... i want to update employee's record but its not being updated.....can u help me out.... no error is shown to me..... <html> <body bgcolor="pink">
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7063
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.