"Print this Page" MSDN Style

G

Guest

Hi all,

I am implementing a "Print this Page" function in my ASP.NET application.
This function should print a part of the page and I would like to use an
MSDN Style "Print this Page".

I'm going to explain what I would like to do.

Clicking on the print button I would like to show immediately the print
dialog without open a new window with the text formatted for printing.

Now if I implement the window.open() on the onclick event of the button it
works like I want but it prints the entire page instead of printing the
portion of a page I want.
I know this is normal, but I would like to implement a behavior like MSDN to
print a part of the web form with just a click without open any additional
window.

For an example of what I am saying check this MSDN article and try to print
it.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/AppArchCh2.asp

Thank you all
 
D

darrel

Clicking on the print button I would like to show immediately the print
dialog without open a new window with the text formatted for printing.

I'd suggest NOT doing that. For one, it doesn't work in every browser.
Secondly, people like to see what they're about to print. Thirdly, a lot of
people actually prefer to read the 'print friendly' version of the page on
screen rather than actually printing it.

Just some things to consider.
Now if I implement the window.open() on the onclick event of the button it
works like I want but it prints the entire page instead of printing the
portion of a page I want.

You need to use CSS for this. You create a CSS file for on-screen rendering
and you create a separate one for print rendering. with your method, you
simply create a print CSS file. For a 'print friendly' page, you'd create a
second CSS file and swap it server-side with some back-end logic.
For an example of what I am saying check this MSDN article and try to print
it.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/AppArchCh2.asp

In this case, it's because MSDN is all frames based...it's just printing one
particular frame.

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top