Quantcast
Channel: Visual Studio Report Controls Forum
Viewing all articles
Browse latest Browse all 519

Odd display behavior in report

$
0
0

Okay, I am seriously stumped! I am building a C# 4.0 WinForms app that uses the Reporting component. It’s working 99% but there’s one really odd quirk I cannot trace down.

The final report contains several subreports. Each subreport shows details about the main category and type of product. If a subreport contains no details for the category and type of product, it displays nothing and the report shrinks to consume that empty space.

Each subreport has its report datasource populated by an ADO.Net DataTable from a typed DataSet.

This all works EXCEPT in one specific instance. With just one category of product, one particular subreport displays as an empty shell. IOW, the subreport structure shows, with its header, but it contains no data. I am banging my head on the desk trying to figure this out.

The logical conclusion is that with this one category the ADO.Net DataTable that feeds the specific subreport’s report datasource must be populating with some data that is informing the subreport to display. But debugging on ALL categories shows that this DataTable has no records in all instances, regardless of the category. So I cannot see how the subreport is reacting to the product category if its datasource is always empty of records.

There is too much code to post, so I’ll offer this walkthrough of what’s going on:

1) User selects a product from a DataGridView that she would like to examine further.

2) An instance of the report form is instantiated.

3) The ADO.Net dataset is passed to the report form.

4) The CategoryId and TypeId the user selected are passed to the report form.

5) LoadData() is called on the report form.

6) LoadData() runs through several TableAdapters and first clears them, then passes either the CategoryId or typeId to them for populating. Debugging at this points shows the particular DataTable I am concerned with has 0 rows.

7) The local report engine is set to the report.

8) The main/parent report has its SubreportProcessing event registered with custom handler processSubreport().

9) processSubreport() adds DataTables to the DataSources collection for each subreport. Debugging at this point shows that the particular DataTable still has no rows.

10) The main/parent report has its datasource set to a DataTable in the DataSet.

11) RefreshReport is called and the report displays.

This is a pretty straightforward chain of events, and it works as long as I don’t select the one particular category. But if the DataTable for the specific subreport is EMPTY regardless of category, HOW can that subreport show, even as an empty shell?

The main report is structured like so, from top to bottom:

1) Page Header.

2) Rectangle object with labels and textboxes.

3) Rectangle object with labels and textboxes.

4) Subreport 1.

5) Subreport 2.

6) Subreport 3.

7) Subreport 4.

8) Subreport 5.

9) Subreport 6.

10) Subreport 7. ß The one with the issue!

11) Rectangle object with labels and textboxes.

12) Textbox.

Each subreport has its KeepTogether property set to True. Most of the subreports use a Tablix for layout, though two use rectangle objects instead (3, 7). Though 7 is the issue, 3 works fine.

I am at a complete loss. Any help would be appreciated.

Kurt


Viewing all articles
Browse latest Browse all 519

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>