473,425 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

window.print() and postpack, how both works?

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?

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.
Nov 19 '05 #1
3 1593
> 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/
Nov 19 '05 #2
Umut,

Why not just use window.print()? Do you really need to have another
postback?

:DG<

"Umut Tezduyar" <ut*******@onmap.com.tr> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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?

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.

Nov 19 '05 #3
Thank you a lot.
This really helped me a lot.

"Anders Norås [MCAD]" <an**********@objectware.no> wrote in message
news:eR**************@TK2MSFTNGP10.phx.gbl...
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/

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John | last post by:
I am having a problem with window.print in a popup window. I am creating 2 popup windows both with a print button in them, 1 works the other doesn't. Code runs in a javascript function on a...
2
by: dan | last post by:
This works in mozilla but I can't figure out why this won't work in IE. Say I have this html <html> header goes here header goes here
2
by: Asad | last post by:
I have a main window that creates a new window called printWin (which contains the printable format of the page). From the main window I embed a javascript in the printWin window that calls the...
0
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you shrink/resize the window the scrollbars adjust...
1
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you shrink/resize the window the scrollbars adjust...
2
by: Bell, Kevin | last post by:
The following works in the interactive window of PythonWin, but fails in a script. TypeError: Objects of type 'slice' can not be converted to a COM VARIANT I just need to parse out these dates,...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
2
by: =?Utf-8?B?RGlmZmlkZW50?= | last post by:
Hello All, I am trying to offer "Print" functionality using an HTML button with the help of "window.print()" This button works fine in Firefox but not in IE7. I am dumping the entire content...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.