Re: window.print() and postpack, how both works?
From: Anders Norås [MCAD] (anders.noras_at_objectware.no)
Date: 12/28/04
- Next message: CuteSoft: "Re: RichText Editor in ASP"
- Previous message: Jerry Spence1: "Creating temporary database on user's PC."
- In reply to: Umut Tezduyar: "window.print() and postpack, how both works?"
- Next in thread: Umut Tezduyar: "Re: window.print() and postpack, how both works?"
- Reply: Umut Tezduyar: "Re: window.print() and postpack, how both works?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 28 Dec 2004 14:41:19 +0100
> 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/
- Next message: CuteSoft: "Re: RichText Editor in ASP"
- Previous message: Jerry Spence1: "Creating temporary database on user's PC."
- In reply to: Umut Tezduyar: "window.print() and postpack, how both works?"
- Next in thread: Umut Tezduyar: "Re: window.print() and postpack, how both works?"
- Reply: Umut Tezduyar: "Re: window.print() and postpack, how both works?"
- Messages sorted by: [ date ] [ thread ]