?
Solved

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

Posted on 2007-07-24
5
Medium Priority
?
416 Views
Last Modified: 2013-11-26
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?
0
Comment
Question by:sergeiweerasuriya
4 Comments
 
LVL 12

Accepted Solution

by:
renjurdevan earned 1000 total points
ID: 19554042
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
 
LVL 9

Assisted Solution

by:codeclay
codeclay earned 1000 total points
ID: 19554756
Its actually a one liner - btnprint.Attributes.Add("onclick", "window.print();return false;");
add this in the page load .
0
 
LVL 14

Expert Comment

by:chinu1310
ID: 19556005
I do it this way. In fact its pretty much same.
 btnPdf.Attributes.Add("onclick", "javascript:window.print();");
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20432485
Forced accept.

Computer101
EE Admin
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

864 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