Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Printing slected contents

Posted on 2007-11-27
14
Medium Priority
?
118 Views
Last Modified: 2010-03-26
I need to generate a reports for printing and emailing. I plan on doing this in HTML using CSS for page breaks, etc. I already have the data on the page and have stored it in a Public Shared DataRow variable so that I don't need to re-query the database. Our current (Classic ASP) system brings up the report in a new popup window and re-queries the database. Not only does this put tremendous strain on the server but our support department receives numerous calls from clients who have problems because of (multiple) popup-blockers running on their browsers.

When a user clicks on the "Print" (or "Email") button I open a ModalPopup where they can select which reports they want to print and then click "Print". The system must now take the stored data and reformat it with the user's information on the top of each page, at an appropriate width for printing, with page breaks, etc... I am using a StringBuilder and then assigning the results to a Label control.

I first tried doing this in a second ModalPopup, but had problems with the server side routines not running with the first ModalPopup immediately trying to call a second one. Also not sure how I would have got it to print just the contents of a ModalPopup. The page already uses TabPanels, so I have thought of putting a <IFRAME> into a new tab. This introduces 2 problems:
1) I have an IFRAME containing a Label and want to set the contents via the Label rather than the "src" of the IFRAME.
2) If I simply add onload="print()" to the IFRAME the client print dialog comes up when the page first loads, even though the TabPanel is not visible at this stage.

How can I get around these issues using the data I already have stored? Is there a better way to tackle this scenario?
0
Comment
Question by:DerekWatling
  • 8
  • 6
14 Comments
 

Author Comment

by:DerekWatling
ID: 20364440
Disregarding re-using the data, I have set up a new page which I can use for the souce of the IFRAME and moved the onload="print()" into the body tag of this page. I just want to print the contents of the IFRAME! However this prints the the whole page with everything around the IFRAME. Due to all the bastards (I'm being polite as this is a public forum) out there using popups for annoying purposes and subsequent proliferation of popup blockers together with the issue of the popup windows becomming hidden behind other windows or opening in a tab rather than as a popup I really DON'T want to use popups. I also must not lose the original window so just loading a new page for printing isn't an option.
0
 
LVL 7

Accepted Solution

by:
Infinite_Recursion earned 2000 total points
ID: 20364648
It is most probable that using browser printing would print whatever is visible on the page, not just in an iframe, whatever is visible in the browser window to be more accurate, so I am guessing that calling it from an iframe makes no real difference. What usually is done when reports are needed, is to actually use reporting tools like for example crystal reports. If you cannot do without browser printing, then I am guessing you have to show in the browser window exactly what you want to print. So, you can redirect to the printing form, that means browsing away from the main page, or another solution would be to create a javascript popup, which is not a real popup, it uses layers through divs to display contents that can be dragged and probably also resized like any window but WITHIN the original window.
Hope this helps.
0
 

Author Comment

by:DerekWatling
ID: 20364728
Pretty much the conclusion that I had come to. More information on the javascript popup would be helpful.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Assisted Solution

by:Infinite_Recursion
Infinite_Recursion earned 2000 total points
ID: 20364768
OK, here is a link to a very useful solution:
http://sublog.subimage.com/articles/2006/01/01/subModal
Now I have customized that one myself for my own use, you can do the same, it is all javascript, I might post some of my enhancements later.
Hope this works.
0
 

Author Comment

by:DerekWatling
ID: 20364882
Thanks for the link. However this seems to be the same as the AJAX ModalPopupExtender that I am already using (and having issues with): I can't get it to go directly from 1 ModalPopup to another and when printing the background page still shows. Might get around the second problem by using a background image instead of a background colour as most browsers are set to print images.
0
 
LVL 7

Expert Comment

by:Infinite_Recursion
ID: 20364897
It is not intended to show multiple layers of modal dialogs, that would be against the idea of modal I guess. Why do you need multiple layers? It is different from the AJAX extender, it can display another page like iframes do.
0
 

Author Comment

by:DerekWatling
ID: 20365054
I don't want to show multiple layers of modal dialogs, what I wanted to do was as the first dialog closes immediately open a second dialog with the report. I can generate the report in a new page or on the same page, that isn't the issue. The biggest problem is when it comes to print. With an IFRAME or Modal Dialog or AJAX ModalPopup IE7 (and I presume other clients) still wants to print what is displayed on the screen rather than just the contents of the current "object".
0
 
LVL 7

Expert Comment

by:Infinite_Recursion
ID: 20365117
yes as I said, that is the case, that is also why we use reporting tools, and that is why reporting tools vendors can sell their products instead of going out of business cause everyone is using simple html.
0
 
LVL 7

Expert Comment

by:Infinite_Recursion
ID: 20365120
A clarification, reporting tools do alot more than just that, so scratch my last comment abt them :)
0
 

Author Comment

by:DerekWatling
ID: 20365155
Unfortunately budget and time constraints are not conducive to implementing a reporting tool at this stage. The requirements also involve including a map image from a GIS system. I don't know if or what issues specific reporting tools might have with that. Due to an ultimatum that something has to launched by Christmas, I have come to the conclusion that for now we will just have to deal with popup blockers. In the new year I will be able to investigate and improve further. So unless there is a simple, cheap solution ...
0
 

Author Comment

by:DerekWatling
ID: 20365165
I won't scrach your comment about reporting tools, just read it in context as not the be-all and end-all.
0
 
LVL 7

Expert Comment

by:Infinite_Recursion
ID: 20365205
OK here is a thought, if you use the link i gave you, and use the javascript dialog, you can set the background to any thing like a totally white background, thus hiding the other content on the page.
0
 

Author Comment

by:DerekWatling
ID: 20365283
I will have a look, but just setting a background-color or background-image doesn't work as most clients are set not to print backgrounds :-{ so when you comne to print the solid background you see on the screen becomes transparent and it looks like 2 pages overprinted. It would need to be a full image in an absolutely positioned div and then I don't know if this can be done or  just how big to make the image so it always covers everything.
0
 

Author Comment

by:DerekWatling
ID: 20371969
Infinite_Recursion
No one else is giving any input on this and you have gone out of your way to answer what you can so the points are comming to you even if I didn't get the type of solution I was hoping for. Thanks for everything.
Derek
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question