C1FlexGrid: BeforePageBreak event firing when no page break is needed

Posted by: lbressler on 16 July 2020, 7:24 am EST

  • Posted 16 July 2020, 7:24 am EST

    I have a report in a C1FlexGrid (4.0.20183.343) which should only print certain rows at the tops of pages, so I'm handling the BeforePageBreak event.


    private void flex_BeforePageBreak(object sender, RowColEventArgs e)
    {
    try
    {
    // this is what I came up with to prevent page breaks midway through a group (without having to keep a dictionary of all the rows)
    if (flex.Rows[e.Row].StyleDisplay.BackColor != flex.Styles[_headerStyle].BackColor)
    {
    e.Cancel = true;
    }
    }
    catch (Exception ex)
    {
    MainFormBase.ErrorHandler.PersistDisplay(ex);
    }
    }


    I'm currently experiencing an issue where a certain amount of data is causing this event to fire even though the entire report fits on less than half the page. Interestingly, if I comment out the cancellation the report prints on one page.

    Why is the event firing when the report can fit on the page, and why is cancelling certain rows causing a page break to be inserted? Documentation on this event says that it is for preventing page breaks, not adding them.
  • Replied 16 July 2020, 6:52 pm EST

    Hello,

    We too can observe the issue with the BeforePageBreak event, thus escalated this to the developers and will let you know once we get any update on this from their end.
    [Internal Tracking ID: 448471]

    Regards,
    Prabhat Sharma.
  • Replied 27 April 2021, 8:44 pm EST

    Hello,

    We are happy to inform you that the issue has been resolved in the latest build 4.5.2.2021.492, please upgrade to the latest version to get rid of this issue.
    You can update your controls using the latest ComponentOneControlPanel utility that you can download from the given link:
    https://www.grapecity.com/componentone/download
    Regards,
    Prabhat Sharma.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels