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

Hiding a Section

4 Answers 546 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 15 Aug 2011, 07:41 PM
Hello,

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

Sort by
0
Peter
Telerik team
answered on 16 Aug 2011, 12:08 PM
Hi Mike,

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 >>

0
Amit
Top achievements
Rank 1
answered on 19 Jan 2018, 03:19 PM

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?

 

0
Amit
Top achievements
Rank 1
answered on 19 Jan 2018, 04:18 PM
I would like to know how to set up binding to make it visible/invisible.
0
Silviya
Telerik team
answered on 22 Jan 2018, 04:25 PM
Hi Amit,

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
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
Tags
General Discussions
Asked by
Mike
Top achievements
Rank 1
Answers by
Peter
Telerik team
Amit
Top achievements
Rank 1
Silviya
Telerik team
Share this question
or