473,385 Members | 1,647 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,385 software developers and data experts.

one Page print another n times?

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
Oct 22 '08 #1
2 3006
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-Def...4714359&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!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"bob" <st**************@cutthis.adriley.co.nzwrote in message
news:h8********************************@4ax.com...
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

Oct 22 '08 #2
bob
Hi Nathan,
Thank you.
That makes it perfectly clear.
Also thanks for the book reference.
regards
Bob

On Wed, 22 Oct 2008 18:29:30 -0400, "Nathan Sokalski"
<nj********@hotmail.comwrote:
>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-Def...4714359&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!
Oct 23 '08 #3

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

Similar topics

179
by: SoloCDM | last post by:
How do I keep my entire web page at a fixed width? ********************************************************************* Signed, SoloCDM
48
by: David J Patrick | last post by:
I'm trying to rewrite the CSS used in http://s92415866.onlinehome.us/files/ScreenplayCSSv2.html. using the w3.org paged media standards as described at http://www.w3.org/TR/REC-CSS2/page.html ...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: ellenricca | last post by:
Hi, I have an Access 2003 db that is used to enter parking ticket info when the ticket is paid. The data is entered via form, and on that form is a command button that prints the Receipt Report...
1
by: Sam | last post by:
Hi All I have a web page that contains a datagrid and in this data grid, I have a checkbox column template which allow user to select one or more applicant's loan applicantion to print....
4
by: evll | last post by:
Hello! I need to print two pages using PrintDocument, but there are some problems. I've got something like that: -button is pressed -two pages need to be printed The code is like that:
7
by: k0mp | last post by:
Hi, Is there a way to retrieve a web page and before it is entirely downloaded, begin to test if a specific string is present and if yes stop the download ? I believe that urllib.openurl(url)...
2
by: tghamm | last post by:
Ok, so this is driving me mad. For some reason, regardless of the value of ev.hasmorepages, the printoducment1_printpage gets called twice for every page. So, I print 2 pages of data on one page,...
35
by: mdh | last post by:
Hi All, this little nonsense function is an attempt to understand function pointers. /*********/ #include <stdio.h> void p(int);
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.