Hiding a Section

5 posts, 0 answers
  1. Mike
    Mike avatar
    59 posts
    Member since:
    Jan 2008

    Posted 15 Aug 2011 Link to this post

    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
  2. Peter
    Admin
    Peter avatar
    1652 posts

    Posted 16 Aug 2011 Link to this post

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

  3. Amit
    Amit avatar
    9 posts
    Member since:
    Dec 2013

    Posted 19 Jan 2018 in reply to Peter Link to this post

    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?

     

  4. Amit
    Amit avatar
    9 posts
    Member since:
    Dec 2013

    Posted 19 Jan 2018 in reply to Amit Link to this post

    I would like to know how to set up binding to make it visible/invisible.
  5. Silviya
    Admin
    Silviya avatar
    380 posts

    Posted 22 Jan 2018 Link to this post

    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
Back to Top