DataGrid: apply style every 60 lines

I am trying to insert pagebreaks into a DataGrid which needs to be printed.
I have found a partial solution at:

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> ?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

GavinMannionConnect With a Mentor Commented:
In the OnItemDataBound event you should be able to add this style to the row every 60 rows.

Create a public variable and when that hits a multiple of 60 add the style.

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 least I couldn't find one.

Good Luck.
astromexAuthor Commented:
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
    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 :)....
All Courses

From novice to tech pro — start learning today.