General discussion


how to incorporate page-break in

By mohithmv ·
Hi All,
I have n records being retrieved from the DB, bind it to a datagrid control and have set the pagination (10 records per page) attribute of the datagrid control.
But i want to introduce page breaks after every 20 records, so that whenever i use the javascript "window.print()" the entire set of data needs to be printed with page breaks after every 20 records.

I have achieved the same using ASP. But not in and C#.

I am using .net 2003, framework 1.1.

We all know that whenever we use window.print, whatever the user is viewing in the browser will be sent for printing only.

Kindly let me know if there is any solution for this.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Tony Hopkinson In reply to how to incorporate page-b ...

You can twiddle away, but all the user needs to do is change the fontsize and your carefully tweaked layout will go nipples up. You can provide a diffent file for printing though. A doc, PDF etc windows.print will output that instead, it's one of the meta tags in the page's header to specify the file with doctype attribute. Course you've got to produce that file as well.
This is the proper way to do it though and it's far better than relying on the user's browser set up.

Collapse -

by Tony Hopkinson In reply to

Agreed, but that was what I was saying. In order to guarantee a readbable output you have to be in control. If you rely o0n the clients browser settings for it to 'fit', you will be bollixed most of the time. Wther you specify your own settings or a separate document doesn't matter. crossing your fingers and hoping a straight output of the browser window will do the job is asking for it.

Collapse -

by bschaettle In reply to how to incorporate page-b ...

Tony, I have to disagree with your comment about a user changing the font size. Granted they can do this on the browser display, but you can control exactly how a page prints using a completely separate style sheet.

<LINK href="PrintStyle.css" type="text/css" rel="stylesheet" media="print">

Here's a slick trick I've used: change the visibility of a class between the displayed and printed style sheets. There's almost no end to the cool stuff you can do by turning entire elements on and off this way.

Related Discussions

Related Forums