473,320 Members | 2,117 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,320 software developers and data experts.

print method in Javascript

I have created a asp.net web form with one datagrid which is used to display some information in tabular format. However, in the page, there are 2 buttons which are "Save" and "Print", when i save the page, i can make the page saved without the 2 buttons in the saved page. However, when i try to print the page by clicking the button, the 2 buttons are shown in the printed page. The result which i want is the page printed without the 2 buttons, how can i achieve this by using javascript. Currently i am using "print()" method in Javascript. Please advice, thank you so much.
Nov 18 '05 #1
4 2053
On Thu, 29 Apr 2004 21:41:04 -0700, "Machi"
<an*******@discussions.microsoft.com> wrote:
I have created a asp.net web form with one datagrid which is used to display some information in tabular format. However, in the page, there are 2 buttons which are "Save" and "Print", when i save the page, i can make the page saved without the 2 buttons in the saved page. However, when i try to print the page by clicking the button, the 2 buttons are shown in the printed page. The result which i want is the page printed without the 2 buttons, how can i achieve this by using javascript. Currently i am using "print()" method in Javascript. Please advice, thank you so much.


Simplest method is to use a Javascript function to do the printing.
Instead of having the button call the print() method, have it call a
method you write... lets say printme().

<button id='printbutton' onclick="printme();".... >

Now write printme...

function printme() {
document.all ['printbutton'].visible = false;
document.print();
document.all ['printbutton'].visible = true;
}
Something like that.

Nov 18 '05 #2
document.print()

seems doesn't pop up any printing window for above codes, that means the suggestion seems doesn't work ...
Nov 18 '05 #3

"Machi" <an*******@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com...
document.print();

seems doesn't pop up any printing window for above codes, that means the

suggestion seems doesn't work ...
Nov 18 '05 #4
Hi Machi,

you can take a look at the following link this may give you some hints
http://www.eggheadcafe.com/articles/20030627a.asp

Regards
Ashish M Bhonkiya
"Machi" <an*******@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com...
document.print();

seems doesn't pop up any printing window for above codes, that means the

suggestion seems doesn't work ...
Nov 18 '05 #5

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

Similar topics

1
by: Michelle | last post by:
I have tried every variation of the "onchange" statement below without any actual reloading of the page. I am hoping that the PHP PRINT statement is constructed wrong, otherwise it is javaScript...
3
by: Marcus Bjorke | last post by:
I use a print link that causes a problem with Opera 7. The link looks like this <a href="javascript:parent.frames.mainFrame.print()">Print this page</a> I also used <a...
4
by: Julie Siebel | last post by:
Apologies...I'm sure this has been asked before, but I can't seem to come up with the correct Google search terms. While my problem is with stylesheets, the errors are being caused by my...
3
by: Umut Tezduyar | last post by:
In the msdn.microsoft.com/library most of the articles have an "print" option. But the "print" button is different from the javascripts "window.print()" method. It postpacks the page and then...
3
by: timasmith | last post by:
Hi, The problem with using HTML as a report writer is primarily the unreliable page breaking. However it is a rather handy way of writing reports with images embedded. I could generate say...
2
by: colinzhu | last post by:
I want to have the print dialog shown automatically after the the page is loaded, but when I try to call window.print() BEFORE the iframe, the print dialog is not shown at all. Anyone can help? ...
1
by: techykans123123 | last post by:
hi all i have a paragraph under a div section in my html page. i need to print those details alone using print method <div>ggggggggggggggggg </div> <div>aaaaaaaaaaa
2
by: bob | last post by:
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 ...
3
by: rajkumarpb | last post by:
Hi friends, I am new to this forum...But not for programming...I want a Print CSS File to be added in my page..OK.... Here is the page and i want you friends to help me create the CSS File...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.