This is a migrated thread and some comments may be shown as answers.

Sections do not shrink if a panel is hidden

13 Answers 1248 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 03 Aug 2014, 02:37 PM
It is true that you can hide panels in a details section, however, the space used in the details section must be as big as everything you have in the section, then if you hide one of the panels, the space already allocated for the panel still shows as white space.

Is there a way to have the section give up it's allotted space if you are hiding a panel?

Thanks,

Philip Carter.

Attached is a screenshot of the design and result


13 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 06 Aug 2014, 02:22 PM
Hi Philip,

Please test to use a binding to the Panel.Visible property or a conditional formatting rule to hide it. Then apply the approach described in the Collapse the container when hiding child report items KB article on the section that needs to be collapsed.


Let us know if you need any further help.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Philip
Top achievements
Rank 1
answered on 06 Aug 2014, 09:05 PM
I figured that out already. I have a problem with the Page Header section showing as white space in the Report Header Section even when it is hidden and if I shrink the height down, then when it is visible, it is that small and doesn't show the header (see screenshots attached). This is a problem because I often use the report header to do a couple of introductory pages that have to use up the entire first couple of pages.
0
Philip
Top achievements
Rank 1
answered on 07 Aug 2014, 03:06 PM
I figured out what to do and I'm going to post it in simple English because coming from a CrystalReports crappy way of doing things, the way Telerik does reporting is way cooler, but completely foreign to anyone used to Crystal Reports.

So here's the jist. If you use the Report Header to build pages that you want before your details section, you will add a group with no grouping expression and that will give you your Group Header where you will put what you want to be your page header and then set the PrintOnEverPage Property to True. then hide the Page Header so no space is taken up on the details pages.

Also, anyone coming from Crystal Reports, should also look at the Bindings property of sections and items. Because there, you can set page breaks and the other things that you are not able to set in the standard conditional formatting. It's a very cool way of doing things.

Thanks Telerik!!!

In case anyone is interested, Here's a link to the report and subreport. It may help you figure out what you can do above and beyond what you can do with Crystal. http://marketplacesoftware.biz/LiveUpdate/ForwardTilt-Proposal.zip  
0
Stef
Telerik team
answered on 11 Aug 2014, 01:36 PM
Hi Philip,

Thank you for your kind words and we are happy to hear you found a solution.

Just in case later you need to use the global objects available in the page sections, you can try a document layout built by several report definitions, which are gathered in a Reportbook. In a report book, each new report starts on a new page, you can add content with different structure, and the whole book is treated as a single document on processing.


I hope the above information helps you.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
David A.
Top achievements
Rank 1
answered on 29 Mar 2015, 12:18 AM
Your solution Philip was a lifesaver.  We have a government form that requires a specific header to only appear on the first page.  For some reason Telerik Reporting has the Report Header print AFTER the Page Header and the blank/empty grouping did the trick.  Thank you for sharing!
0
Philip
Top achievements
Rank 1
answered on 30 Mar 2015, 07:54 AM
Glad to help. Before you get too frustrated with Telerik Reporting, keep in mind that I haven't run up against anything that I could do in Crystal that I can't replicate in Telerik Reporting. Head into your problem assuming there is a way to do it, but you haven't found it yet and you will get there, generally within a couple of hours of thinking and trying different options. Like with subreports. if you're like me, you use many subreports on one report. The general thinking would be to dock the subreports to the top to take up the blank space, but in all actuality, you will just put them one right next to each other and they magically fill in the white space if a subreport is hidden (I spent a couple hours on this one)
0
David A.
Top achievements
Rank 1
answered on 30 Mar 2015, 02:02 PM
I certainly agree that there is always a way to do it with Telerik Reports, and it is the best out of itself, ActiveReports, and CrystalReports.  There are just things that were way easier and much more intuitive in ActiveReports (report header prints before page header, multi-column reports flow L to R) that are only able to be done in Telerik Reports via a hack.
0
Tim
Top achievements
Rank 1
answered on 11 Mar 2016, 09:00 PM
Problem statement: We need to hide empty sub reports if the entire sub report is empty and if not entirely empty then hide empty panels or sections within the sub report while minimizing white space.

I am posting how we solved the hiding empty sections and subsequent white space problem in case someone winds up in a similar case.  We followed the advice of several posts about setting the initial height of the details section to 0.  This works in most cases.  In the sub report we had issues with white space where we had about 6 panels stacked on top of each other vertically.  We set their initial heights to 0 and hid them accordingly but the white space still appeared at the bottom of the sub report causing intermittent white space between sub reports as well as generating extra pages as a result.  

In the detail section item data bound event we used ElementTreeHelper to get all of the direct Panel children of the sub report details section and set their heights to 0.  Then we started an accumulator at 0 and for each visible panel set the top property equal to the accumulator value and then added the visible panel's height to the accumulator.  This effectively re-positions all the visible panels to be adjacent to each other vertically.  But the key for eliminating the white space was to set the Top to 0 for each INVISIBLE panel.  I am assuming that this moves the invisible panel under the visible panel at render time in such a way that the white space where the panel was hidden from is not rendered.  You may suppose that setting the docking to top for the panels in question would make them snap up and shrink the element but I did not have success with that approach.

As an side, I found it helpful to set colored borders around each panel or sub report to derive how the rendering responds to attempts to control the white space.  I tried various techniques to accomplish this such as bindings, conditional formatting, expressions using =COUNT(Fields.NameOfField) > 0, and the like but nothing else seemed to work or had various quirks.  One issue I had with using an expression on a sub report and setting Parent.Parent.Visible or something similar is it locks the sub report into a specific hierarchy for the functionality to work.  With this solution wherever the sub report is included it will shrink it's panels to the min height.

So overall our report uses the following approach to hide empty sub reports and possibly panels within those sub reports and shrink all the white space those elements occupied.
1. In master report constructor set master report detail data bound event to set detail height to 0; set sub report item data bound event for each sub report
2. In sub report data bound event get detail section and hide if no data.
3. In any sub reports that need to further hide panels attach item data bound event to the sub report detail and in that event hide panels with no data.
3. For each visible panel, set top to 0 for first panel or prior panel's top + prior panel's height for subsequent panels.  For each invisible panel set Top to 0
4. Rejoice

The hide element if no data algorithm:
1. Set element height to 0.
2. Get all child data containing elements (Table, TextBox, HtmlTextBox, whatever yours may be) and check each element to have a value.  
3. If any value, set element visible = true else set element visible = false.

We accomplished Step 2 by creating a recursive iterator that uses ElementTreeHelper internally so that I can get all children under a panel, detail, or an element and then use LINQ to filter it to a specific type.  To distinguish between Textboxes used for display that will always have values and thus make the element visible we used a convention based approach where the text box name begins with "EData_".  With this approach we can get just the boxes that are data bound.  So effectively we have Parent.Visible = Parent.Children.Any(x => x.IsDataBound() && x.HasValue());

I had seen various cautions AGAINST modifying elements in this way during the Telerik.Reporting.Processing phase but at this time have not seen any negative side effects and it seems sometimes this method is endorsed and sometimes it is not.
0
Stef
Telerik team
answered on 15 Mar 2016, 05:14 PM
Hello everyone,

One more approach utilizing the Reporting expression engine that we can suggest is discussed in the How to hide subreports that has no data forum thread and the Collapse the container when hiding child report items KB article.

I hope this information is helpful.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 19 Sep 2018, 12:49 PM

[quote]Philip said:I figured out what to do and I'm going to post it in simple English because coming from a CrystalReports crappy way of doing things, the way Telerik does reporting is way cooler, but completely foreign to anyone used to Crystal Reports.

So here's the jist. If you use the Report Header to build pages that you want before your details section, you will add a group with no grouping expression and that will give you your Group Header where you will put what you want to be your page header and then set the PrintOnEverPage Property to True. then hide the Page Header so no space is taken up on the details pages.

Also, anyone coming from Crystal Reports, should also look at the Bindings property of sections and items. Because there, you can set page breaks and the other things that you are not able to set in the standard conditional formatting. It's a very cool way of doing things.

Thanks Telerik!!!

In case anyone is interested, Here's a link to the report and subreport. It may help you figure out what you can do above and beyond what you can do with Crystal. http://marketplacesoftware.biz/LiveUpdate/ForwardTilt-Proposal.zip  
[/quote]

While this is a good workaround, for a standard report (1 column, default setting for page), reports that are set up as multi columns, this won't work. The Report Header Band and all Group Bands will be the same size as each column.  Also, this doesn't fix the issue that the Page Header is a constant height and doesn't GROW or SHRIK as necessary when you have controls in it that you hide under certain conditions (something other report writers allow, even our existing legacy software package written in Visual FoxPro supported this).  I am confused why Telerik is treating the Report Header Band similar to a group band, in fact, the way it behaves to me, is it is a group band that doesn't require an expression.  


0
Russell
Top achievements
Rank 1
answered on 26 Sep 2018, 08:06 PM
[quote]Mark said:

While this is a good workaround, for a standard report (1 column, default setting for page), reports that are set up as multi columns, this won't work. The Report Header Band and all Group Bands will be the same size as each column.  Also, this doesn't fix the issue that the Page Header is a constant height and doesn't GROW or SHRINK as necessary when you have controls in it that you hide under certain conditions (something other report writers allow, even our existing legacy software package written in Visual FoxPro supported this).  I am confused why Telerik is treating the Report Header Band similar to a group band, in fact, the way it behaves to me, is it is a group band that doesn't require an expression.  


[/quote]

 

This...x 100. The Group Header Section is great for creating manual page breaks, but if you want anything in there that dynamically sizes you are out of luck.

0
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 26 Sep 2018, 09:02 PM
[quote]Russell said:[quote]Mark said:

While this is a good workaround, for a standard report (1 column, default setting for page), reports that are set up as multi columns, this won't work. The Report Header Band and all Group Bands will be the same size as each column.  Also, this doesn't fix the issue that the Page Header is a constant height and doesn't GROW or SHRINK as necessary when you have controls in it that you hide under certain conditions (something other report writers allow, even our existing legacy software package written in Visual FoxPro supported this).  I am confused why Telerik is treating the Report Header Band similar to a group band, in fact, the way it behaves to me, is it is a group band that doesn't require an expression.  


[/quote]

 

This...x 100. The Group Header Section is great for creating manual page breaks, but if you want anything in there that dynamically sizes you are out of luck.

[/quote]

 

Support this feedback request: https://feedback.telerik.com/Project/162/Feedback/Details/256698-page-header-band-that-grows-shrink-based-on-controls-in-it


0
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 26 Sep 2018, 09:03 PM
[quote]Russell said:[quote]Mark said:

While this is a good workaround, for a standard report (1 column, default setting for page), reports that are set up as multi columns, this won't work. The Report Header Band and all Group Bands will be the same size as each column.  Also, this doesn't fix the issue that the Page Header is a constant height and doesn't GROW or SHRINK as necessary when you have controls in it that you hide under certain conditions (something other report writers allow, even our existing legacy software package written in Visual FoxPro supported this).  I am confused why Telerik is treating the Report Header Band similar to a group band, in fact, the way it behaves to me, is it is a group band that doesn't require an expression.  


[/quote]

 

This...x 100. The Group Header Section is great for creating manual page breaks, but if you want anything in there that dynamically sizes you are out of luck.

[/quote]

 

Support this feedback request: https://feedback.telerik.com/Project/162/Feedback/Details/256698-page-header-band-that-grows-shrink-based-on-controls-in-it


Tags
General Discussions
Asked by
Philip
Top achievements
Rank 1
Answers by
Stef
Telerik team
Philip
Top achievements
Rank 1
David A.
Top achievements
Rank 1
Tim
Top achievements
Rank 1
Mark
Top achievements
Rank 2
Iron
Iron
Veteran
Russell
Top achievements
Rank 1
Share this question
or