Solved

How to trigger print command in aspx and c#?

Posted on 2009-05-06
2
929 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
start a process from a service 3 22
Convert datetime to time string 10 21
Problem with SelectList in .NET MVC application 1 14
Jquery 2 11
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

773 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