ASP.NET 2.0 - how to assign the print command to a button

I have created a webform in asp.net 2.0. The user inputs the data to the first page and then clicks on a button named 'continue'. The iput data is passed to the results page and there's a button named 'print' on the results page. When the user clicks on the print button i want the page to be printed. How do i do this?
sergeiweerasuriyaAsked:
Who is Participating?
 
renjurdevanCommented:
you can do it with javascript

window.print()


please go through link

http://www.w3schools.com/htmldom/met_win_print.asp

http://www.htmlgoodies.com/beyond/javascript/article.php/3471121

Regards
Renju
0
 
codeclayCommented:
Its actually a one liner - btnprint.Attributes.Add("onclick", "window.print();return false;");
add this in the page load .
0
 
chinu1310Commented:
I do it this way. In fact its pretty much same.
 btnPdf.Attributes.Add("onclick", "javascript:window.print();");
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.