Maybe this is dumb, but I'm having a surprisingly difficult time trying to hide a report header programmatically.
I can set the visible property using a binding or something, but the height of the item remains in the rendered report. I've had a lot of trouble binding the height property, but I think I figured out a way to do it and it doesn't seem to have any effect.
How can I have a report parameter that's something like "ShowHeader" and have that determine whether the header of the report renders?
Thanks,
Mike
4 Answers, 1 is accepted
Your assumption is correct to set the section/item visibility property you have to utilize binding and for your scenario you will need Boolean report parameter. Check out the following binding example:
Property Path | Expression |
Visible | =Parameter.MyBooleanParameter.Value |
However Telerik Reporting sections by design behavior is to keep the space they occupy no matter their visibility. As a workaround our suggestion is to set the section (report header) height to a very small value in code behind just after the InitializeComponent() is called in the report's constructor. As shown in the following code snippet. This will keep your design time intact and in the same time initially will shrink the report's header section.
public
partial
class
Report11 : Telerik.Reporting.Report
{
public
Report11()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
this
.reportHeaderSection1.Height = Unit.Pixel(1);
}
The above workaround is not applicable for Page Header/Footer sections.
Kind regards,Peter
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Hello Telerik team,
I tried this solution to hide reportheadersection but it didn't work. Can you please let me know if any other setting needed to be set?

I am not sure about the exact logic for toggling the Report Header section. For a reference, I created a sample that demonstrates the required configurations.
There are two approaches in order to hide a section - by using Conditional formatting rule or Binding rule:
1. The conditional formatting rule is set to the Report Header Section by matching false value of the parameter in order to hide it. For your convenience I attached a sample demo report that illustrates how to show/hide the section by using parameter and conditional formatting rule.
2. The same behavior can be achieved by adding a Binding to the Report header section. You can set property path to Visible and Expression to "= Parameters.ParameterName.Value"
Regards,
Silviya
Progress Telerik