> In the msdn.microsoft.com/library most of the articles have an "print"
option. But the "print" button is different from the javascripts
"window.print()" method. It postpacks the page and then invokes the
window.print () method. I couldn't found out the way it works. I need to
do something like this, can any body help me?
Emit the javascript code to print the page in the click event handler. Like
this:
protected void Button_Click(object sender, System.EventArgs e) {
Page.RegisterStartupScript("PrintPage","<script
language=\"JavaScript\">window.print();</script>");
}
Also, i got a collection, and i want to print each of the items in the
collection to a seperate page. If i do it with the <div> tags and arrange
the height of it, is it same as for all different printers. Is there
another way for it.
Use the page-break-before or page-break-after CSS styles to control page
breaks when printing.
<HR style="page-break-before: always;">
<!--- HTML to be on the page -->
You cannot use the window.print() method to print the contents of a
collection. Therefore you'll have to render each element as HTML. Use HTML
code similar to the example above to force page breaks.
Anders Norås
http://dotnetjunkies.com/weblog/anoras/