You can try this.
add a line in your javascript function before window.print
window.onafterprint = CloseMe;
then add a javascript function
function closeMe(){
window.close();
}
that might not work however unless you created the new window as a pop up.
If you just redirected to page2.aspx, change closeMe() like so...
function closeMe(){
window.navigate('Page1.aspx');
}
this will just navigate you back to the original page.
HTH,
Dean Fiala
-----------------------------
Very Practical Software, Inc.
http://www.vpsw.com/links.aspx
-----Original Message-----
From: Sirisha Upadhyayala [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 12, 2004 10:26 AM
To: [EMAIL PROTECTED]
Subject: RE: [AspNetAnyQuestionIsOk] Printing a datagrid - Doesn't close
the window after printing.
My print button is on Page1.aspx. when i click on print, I am saying opening
Page2.aspx. In Page2.aspx, on load, I am giving window.print();
window.close(). It prints the form (gives a print dialog box), but it
doesn't close the window. How can I close the window after printing?
Dean Fiala <[EMAIL PROTECTED]> wrote:Printing what is displayed in the browser
requires some javascript and what
you see is pretty much what you get.
This javascript will print out the current web form...
function printMe(){
window.print();
}
If you just want to print out the grid, you can have a javascript function
that opens a form that just just contains the grid, print it out, and close
the form.
HTH,
Dean Fiala
-----------------------------
Very Practical Software, Inc.
http://www.vpsw.com/links.aspx
-----Original Message-----
From: geethnemani [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 09, 2004 12:07 PM
To: [EMAIL PROTECTED]
Subject: [AspNetAnyQuestionIsOk] Printing a datagrid
Hi,
I have a WEBFORM with a datagrid and a print button. On click of the
button I would like to print the datagrid. There are few pointers in
MSDN regarding printing windowforms and printing datagrid in
windowsforms. But I am working with webforms. If anybody knows how
to work with this, please let me know. Any help would be really
appreciated.
Thanks,
Sirisha
Yahoo! Groups Links
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2'
[Non-text portions of this message have been removed]
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/