Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange DataGrid Printing Behavior

Status
Not open for further replies.

RiverGuy

Programmer
Jul 18, 2002
5,011
US
Hey, has anyone run into this:

I have a datagrid on my aspx page. If I print out the page, if the datagrid continues onto a new page, the grid lines will not print. Is there any work around?
 
River: There is one approach that looks pretty good located at .NET247, q.v.,

The following assumes a button named PrintGrid, a DataGrid control named DataGrid1, and a PrintDocument component named PrintDocument 1:

Private Sub PrintGrid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintGrid.Click
PrintDocument1.Print()
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim myPaintArgs As New PaintEventArgs(e.Graphics, New Rectangle(New Point(0, 0), Me.Size))
Me.InvokePaint(DataGrid1, myPaintArgs)
End Sub


..haven't tested it; thought you might give it a shot.
 
Thanks. I'm not sure if it will work with web-forms. Its worth a shot though. I'll try it out.
 
River: You may be right. Have you tried the javascript print routine?
 
Isadore,

No I haven't. Thats again for the idea.
 
River: Over the last few days have been keeping an eye out on this printing business, not involved myself at this time with the issues. Seems there is very strong argument to use Crystal Reports; lot of support for that; might look into that, e.g., at the MS .NET Forum et al.
 
I agree. I have been working with Crystal Reports on the web for other things, although I am having problems with the printing there too. I can print with the IE print, but not the Crystal print button which exports it to pdf.
 
I noticed there were quite a bit of discussions going on with the Crystal Reports over at Microsoft's dot NET forum; might preview some of the threads there.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top