Link to home
Start Free TrialLog in
Avatar of astromex
astromex

asked on

DataGrid: apply style every 60 lines

Hi,
I am trying to insert pagebreaks into a DataGrid which needs to be printed.
I have found a partial solution at:
http://techrepublic.com.com/5208-11196-0.html?forumID=73&threadID=187861

This says to use a style on the <TR>, like this:
<tr style="page-break-before: always;">

This works great in plain html, but how do I tell my DataGrid to build this into every 60th <TR> ?
Thanks
Avatar of af4643
af4643

I'm not sure you can actually break the datagrid.

Best thing, if you have crystal reports, you can have your report formatted the right way and output it to the web as a pdf, etc., including breaks.

sorry I can't give you a better solution, but I've needed to do that also because there's no way to break a datagrid...at least I couldn't find one.

Good Luck.
ASKER CERTIFIED SOLUTION
Avatar of GavinMannion
GavinMannion

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of astromex

ASKER

Thanks GavinMannion, That worked very well indeed !

  Public RowCount as Integer
  Protected Sub ApplyStyle(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
    RowCount = RowCount+1
    If RowCount=60 then
      e.Item.Style.Add("page-break-before","always")
      RowCount=0
    End If
  End Sub
:), Hey it's only a pleasure.

I just got my first points in the VB.NET TA and I can't even code in VB properly :)....