Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP - print button or print image

Posted on 2014-04-23
6
Medium Priority
?
1,097 Views
Last Modified: 2014-05-28
I have an ASP page that I need to print. User can right click on the page and select 'print' and this is ok, but I want to add an icon to print the page. If simply add an image with javascript then the icon is also printed along with the ASP page.
I want to add either an image or a button that sends the ASP page to the printer but does NOT print the icon (image) or the button.

How can I do this ?
0
Comment
Question by:amucinobluedot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 1000 total points
ID: 40017934
Create a css for print http://www.w3schools.com/css/css_mediatypes.aspa and set the class of the print button to not display for print.  You could create a separate page for printing but that is extra work.

@media print
  {
  .print_button {display:none}
  }

Open in new window

0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 1000 total points
ID: 40017974
since you want an actual button or image to print the page, I would open up the page in a modal window, then in the load event of the modal dialog, you can use window.print() to open up the printer dialog window.

so on your main page, you would have something like:

<input type="button" value="Print" onclick="window.open( '/printPage.asp' );" />

and in printPage.asp, you add the following line to your onload event of the page:

window.print()

if you want everything on the same page, you could do something like this (if you don't want to go the css route Scott Suggested:

<input id="printMe"  type="button" value="Print" onclick="printPage()" />

and your function would look like:

function printPage() {
     //-- hide the button (and whatever else you don't want shown
     document.getElementById('printMe').display = 'none';

    //-- window.print();
}
0
 

Author Comment

by:amucinobluedot
ID: 40018352
Thank you. I will give this a try
0
 
LVL 58

Expert Comment

by:Gary
ID: 40095724
I've requested that this question be closed as follows:

Accepted answer: 500 points for padas's comment #a40017934

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 

Author Closing Comment

by:amucinobluedot
ID: 40095725
Sorry for the delay
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

670 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