Solved

How to trigger print command in aspx and c#?

Posted on 2009-05-06
2
927 Views
Last Modified: 2013-12-17
Hi

I have a aspx page with table and list of data.

I want to print it out by clicking a button.

How should I write it in C#?
0
Comment
Question by:techques
2 Comments
 
LVL 13

Accepted Solution

by:
copyPasteGhost earned 25 total points
ID: 24314803
put this in your page_load

Page.RegisterStartupScript("myScript", "<script language=JavaScript>window.print();</script>");
0
 
LVL 12

Assisted Solution

by:GuitarRich
GuitarRich earned 25 total points
ID: 24314956
if you want to print it from a button do this
<asp:button id="button1" runat="server" OnClientClick="javascript:window.print();" text="Print Form"></asp.button>
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

862 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now