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.
Need extra support?

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

Learn More

Forum Channels