Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1165
Print Parent Band w/ Children
posted

Is there a way to print a single, selected parent band, plus the corresponding child bands, which are displaying control containers with user controls? 

  • 469350
    Offline posted

    Sure, just hide all of the other rows in the print layout. Here's some quick sample code. The code checks to see if the row is in the Print Layout (so that we do not affect the on-screen rows) and that the row is in Band 0 (the root band). If so, it gets the real grid row to see if it is selected and if it's not selected, it hides the row, thereby removing it from the print layout.


            private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
            {
                UltraGrid grid = (UltraGrid)sender;
                if (e.Row.Band.Index == 0 && e.Row.Band.Layout.IsPrintLayout)
                {
                    UltraGridRow realRow = grid.GetRowFromPrintRow(e.Row);
                    if (realRow.Selected == false)
                        e.Row.Hidden = true;
                }
            }