I'm still very new at using Reporting Services in ASP.NET.
As near as I can tell, there seems to be no properties or events in the ReportViewer dealing with subreports. Is this correct? If so, is it true that the only way to set a datasource for a subreport in ReportViewer is by using a custom event handler in the
code behind of a web form?
I have found several examples of how to do this using DataSets, but I have not found any using the Entity Framework. Can anyone explain to me how this can be done or where I can find a tutorial about how to do it?
After finding several examples of code, I've come up with the following code. However, I am getting "Data retrieval failed for the subreport" error on my .aspx page. The main report and subreport works fine in BIDS 2008, so it has to be something wrong my
.cs or .aspx pages.
Still no answers??? Is this problem really that difficult?? Maybe I should try using Datasets instead of Entities? If that's the case, I thought that Entities are the latest and best way to access data, why can't I use them for a ReportViewer?? Any ideas???
I finally managed to get this to work. He's how I did it in case anyone else has this problem. I basically used DataSets with ObjectDataSources instead of Entities with EntityDataSources.
Apparently you cannot use subreports with EntityDataSources??? If someone can accomplish this with Entities, please reply and let me know how you did it!
I also had to make some changes in the code behind that links the subreport datasource in the FormView. Orginally I was adding the SubreportProcessingHandler only when the dropdown had no value. Dumb mistake! Of course it needed to be added when a value
in the dropdown was selected, not the other way around.
Finally another problem I ran into was that the report was loading very slowly. This was because I was not filtering the subreport data with the dropdown.
None
0 Points
22 Posts
Binding an Entity Data Source to a Subform in ReportViewer
Feb 05, 2013 08:20 PM|SonnyTate|LINK
I'm still very new at using Reporting Services in ASP.NET.
As near as I can tell, there seems to be no properties or events in the ReportViewer dealing with subreports. Is this correct? If so, is it true that the only way to set a datasource for a subreport in ReportViewer is by using a custom event handler in the code behind of a web form?
I have found several examples of how to do this using DataSets, but I have not found any using the Entity Framework. Can anyone explain to me how this can be done or where I can find a tutorial about how to do it?
None
0 Points
22 Posts
Re: Binding an Entity Data Source to a Subform in ReportViewer
Feb 11, 2013 02:40 PM|SonnyTate|LINK
After finding several examples of code, I've come up with the following code. However, I am getting "Data retrieval failed for the subreport" error on my .aspx page. The main report and subreport works fine in BIDS 2008, so it has to be something wrong my .cs or .aspx pages.
Here's the .aspx code:
Here's the .cs code behind for the same page:
Can anyone tell me what I'm doing wrong?
Thanks!
None
0 Points
22 Posts
Re: Binding an Entity Data Source to a Subform in ReportViewer
Mar 06, 2013 11:04 AM|SonnyTate|LINK
Still no answers??? Is this problem really that difficult?? Maybe I should try using Datasets instead of Entities? If that's the case, I thought that Entities are the latest and best way to access data, why can't I use them for a ReportViewer?? Any ideas???
None
0 Points
22 Posts
Re: Binding an Entity Data Source to a Subform in ReportViewer
Mar 15, 2013 01:03 PM|SonnyTate|LINK
One other thing I forgot to mention: I'm using Visual Studio 2010.
None
0 Points
22 Posts
Re: Binding an Entity Data Source to a Subform in ReportViewer
Mar 18, 2013 02:34 PM|SonnyTate|LINK
I finally managed to get this to work. He's how I did it in case anyone else has this problem. I basically used DataSets with ObjectDataSources instead of Entities with EntityDataSources. Apparently you cannot use subreports with EntityDataSources??? If someone can accomplish this with Entities, please reply and let me know how you did it!
I also had to make some changes in the code behind that links the subreport datasource in the FormView. Orginally I was adding the SubreportProcessingHandler only when the dropdown had no value. Dumb mistake! Of course it needed to be added when a value in the dropdown was selected, not the other way around.
Finally another problem I ran into was that the report was loading very slowly. This was because I was not filtering the subreport data with the dropdown.
Here's the revised code:
ASP Page:
And here's the code behind:
I hope this helps, but I'd still like to know why I can't seem to get Entities to work with this!
~Sonny