0

I'm trying to skip my TR from the table, but I can't apply it. If my page is equal to one and countSeq = 2 then it sets the value of always. skip to the next page.

I'm trying:

 <table class="table table-striped table-itens-pedido-report">
                            <thead style="border: none !important;">
                                <tr style="border: none !important">
                                    @if (ViewBag.bSeqProduto == true)
                                    {
                                        <th style="width:3% !important ; border: none !important;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;font-weight: 600 !important;font-size: 12px !important;">SEQ</th>
                                    }
                                    @if (ViewBag.bImagemProduto == true)
                                    {
                                        <th style="width:5% !important ; border: none !important;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;font-weight: 600 !important;font-size: 12px !important;">IMAGEM</th>
                                    }

                                   
                                    @if (ViewBag.bTotalProduto)
                                    {
                                        <th style="width:8% !important ; border: none !important ; text-align:center !important;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;font-weight: 600 !important;font-size: 12px !important;">TOTAL</th>
                                    }

                                </tr>

                            </thead>

                            @{int contadorSeq = 0;}
                            <tbody>
                                @foreach (var item in agrupar.Distinct())
                                {
                                    string classPageBreak = "always";
                                    if ((pagina == 1 && contadorSeq == 2) || contadorSeq >= 1)
                                    {
                                        classPageBreak = "always";
                                    }

                                    <tr style="border: none !important;     page-break-after: @(classPageBreak) ">

                                        @if (ViewBag.bSeqProduto == true)
                                        {
                                            <th style="font-size: 13px !important; width:3% !important ; text-align:center">@contadorSeq</th>
                                        }
                      </tr>
                      </table>

enter image description here

Summing up the problem, I need to jump from tr, the programming logic is working.

1 Answers1

1

You will have to insert some style in the document head

<head>
    <style>
        @media print {
            tr.page-break  { display: block; page-break-before: always; }
        }   
    </style>
</head>

This is the answer that describes it

Applying "page-break-before" to a table row (tr)

jet_24
  • 598
  • 3
  • 8