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
astromexAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

af4643Commented:
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.
0
GavinMannionCommented:
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.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
      e.Item.Style.Add("page-break-before","always")
      RowCount=0
    End If
  End Sub
0
GavinMannionCommented:
:), 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 :)....
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.