one Page print another n times?

  • Thread starter Thread starter bob
  • Start date Start date
B

bob

Hi,
I have a page that has a collection of things which it passes to a
second 'print' page using a session variable.

The print page has buttons for moving though the collection and the
user prints by using the browser print button then moves to the next
one in the session collection.

All very tedious but I know no better.



The missing pieces of my puzzle;
1) How do you programatically print with ASP.net?

2) Ideally the print page would update from the session variable
and print itself n times until all members of the collection have been
printed.

Is this possible?

I am getting the feeling that I need to use Javescript seeing I am
essentially asking for a client side action.

If so is there a Javescript tutorial or book you would recommend for
someone who has never used it.


thanks
Bob
 
The most important JavaScript method you will need to use is the
window.print() method. From what I can tell, you will need to create an
ASP.NET Page that the user never actually uses, but is the one that does the
printing. If this sounds confusing, see if this helps:

1. Create an ASP.NET Page that accepts any necessary parameters using a
querystring. This Page will include the JavaScript window.print() and
window.close() methods in the JavaScript onload eventhandler as follows:

<body onload="window.print();window.close();">

This will cause the Page to print and close without the user needing to do
anything.

2. In your initial page that you want the user to see, generate the
following JavaScript for each item you want to print:

window.open('http://www.yoursite.com/printpage.aspx?param1=value1&param2=value2');

By doing this you will be opening the printpage multiple times, but with a
different querystring so that each of your desired items gets printed. I may
not have given the best instructions, but hopefully you are understanding
the technique I am suggesting, and now know the necessary JavaScript to do
it. I would strongly recommend that you learn more about JavaScript, now web
developer will survive very long without it. Even with all the JavaScript
that ASP.NET generates for you, you still need to know the basics for the
sake of debugging, and you will probably need to write some on your own at
some point. A very good book for JavaScript is:

JavaScript: The Definitive Guide by David Flanagan
http://www.amazon.com/JavaScript-De...=sr_1_1?ie=UTF8&s=books&qid=1224714359&sr=8-1

Hopefully all this helps. I haven't seen your site, but I would suggest also
considering making a single page that the user can print that contains all
the items, most people don't want to print more pages than necessary. Good
Luck!
 
Hi Nathan,
Thank you.
That makes it perfectly clear.
Also thanks for the book reference.
regards
Bob
 
Back
Top