<p>I know there's a bug with conditional visibility and page breaks with SQL 2005, but I wonder if anyone has come up with a work around.</p>

<p>I have a table that has a conditional visibility expression, and I need a page break at the end of the table.</p>

<ul>
<li>If I set the PageBreakAtEnd property to true. It is ignored no matter what. Remove the visibility condition and it works.</li>
<li>If I place the table inside a rectangle with the conditional visibility on the table, and the page break on the table. Same result. The page break property is ignored.</li>
<li>If I set the rectangle with the PageBreakAtEnd property and the table with the visibility condition, then I still get a page break even when the table isn't shown.</li>
</ul>

<p>Any other ideas on what to try? I'm almost at the point where I need a separate report rather than conditional visibility :(</p>

<p><strong>Edit: @Josh:</strong> That has the same problems. If the second table has conditional visibility it doesn't work. If it doesn't have the visibility expression, then I get the page break all the time.</p>

<p>@<strong>Erick:</strong> I really wanted that to be the answer but unfortunately it doesn't work. When the visibility expression evaluates to hidden, there's a big gap where the rectangles would be (which I can live with), and when it evaluates to visible, the page breaks still don't work. </p>

[{'answer_id': 8446, 'author': 'Josh', 'author_id': 257, 'author_profile': 'https://Stackoverflow.com/users/257', 'pm_score': 0, 'selected': False, 'text': '<p>Add a second (empty) table immediately after the first.  Page break after that.</p>\n'}, {'answer_id': 12283, 'author': 'Erick B', 'author_id': 1373, 'author_profile': 'https://Stackoverflow.com/users/1373', 'pm_score': 5, 'selected': True, 'text': "<p>Place two rectangles, one inside the other.<br>\nPlace your table inside the inner rectangle and set it to always be visible.<br>\nSet the inner rectangle's Page Break to Insert After Rectangle.<br>\nSet the outer rectangle's visibility to use your conditional expression.</p>\n\n<p>The page break and the conditional visibility are now separated, and the inner rectangle's page break won't be processed if it is not visible, but it will if it is visible.</p>\n\n<p><strong>Edit</strong>: When I tried this, it did not appear to work in the Preview tab in Visual Studio, but it did work in the Print Preview and when I exported the report to PDF.</p>\n"}, {'answer_id': 1151967, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>Hi This is Bala samsnai, \nMe too came accross the same type of error.</p>\n\n<p>I soveled this with out using Rectangle.</p>\n\n<p>Instead of giving the expression to the complete(whole table)</p>\n\n<p>select the one row in that tabe,give the visibilty expression. like that repeat it for all the rows (like  Header, Detailed, Footer) and give the visibilty expression.</p>\n\n<p>By that we can get work both the Visibilty and Pagging both at a time</p>\n\n<p>Bala samsani</p>\n'}, {'answer_id': 1890497, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I tried Bala Samsnai solution and it works. Will explain more later. Erik B\'s solution of uisng two rectangles kind of worked when I hit a snag that I cannot embed a table in the Detail row of another table. So that was a bummer. </p>\n\n<p>I followed Bala\'s solution with my report, which contains only one table and two groups within the table. Instead of adopting and applying an expression to control the Visibility of Groups, I just left that as Visible and applied the Visibility condition expression to each row\'s Hidden property. Right click on the Row Handle on the far left and you will properties window popup on the right or left (usually as a tab next to Solution explorer). In the Visibility grouping, you will see a property called "Hidden" which will have a default value of FALSE. click on the value and in the dropdown, first option is an expression. Viola and you can setup you condition when the row is hidden. It worked like a charm for me. </p>\n\n<p>Hope this helps others. In my case, I had to not show the details section when some of the values where 0. </p>\n'}, {'answer_id': 2012821, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I struggled with this problem for quite a few hours until I discovered that the my layout was to <strong>wide</strong> to fit on print (A4). I had used the extra width for commenting the different field in text boxes with Hidden=false, and as a result twice as many pages as neccessary were generated to display whitespace. </p>\n\n<p>So, you might want to check page width as well. </p>\n'}, {'answer_id': 12525533, 'author': 'Mike D.', 'author_id': 201021, 'author_profile': 'https://Stackoverflow.com/users/201021', 'pm_score': 1, 'selected': False, 'text': '<p>Use a rectangle, which has the conditional visibility set, and an empty table inside of that rectangle which has the "insert page break before" setting enabled. </p>\n'}, {'answer_id': 17228976, 'author': 'Fandango68', 'author_id': 2181188, 'author_profile': 'https://Stackoverflow.com/users/2181188', 'pm_score': 0, 'selected': False, 'text': '<p>One thing I noticed is the differences between reports even though I have used the same report as a "template" across different times in SSRS2005. What I mean is, if you open the report you\'re having problems with in a programmer\'s editor (say UltraEdit) and look at the RDL file, you may pick up slight variations in page width and height. I noticed this and adjusted the report I was having problems with to the correct width of the paper expected and the report printed perfectly in both PDF and at the printer, and at print preview. Just a thought.</p>\n'}]
['https://Stackoverflow.com/questions/8439', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/233/']