Can someone please help me the printing code.

Posted by Kuki123 under ASP.NET on 2/22/2012 | Points: 10 | Views : 762 | Status : [Member] | Replies : 5
Hi Team,

am new in this field of C# so i really need you help. i have a web form with a print button, now i want when i click the print button that web form to be sent to the print and be printed.



Regard

George




Responses

Posted by: Neer on: 2/23/2012 [Member] Starter | Points: 25

Up
0
Down
U just need to type

printForm1.Print(); // i.e. Ur Form Or Page Name.Print() there is built in method.

if it works mark this as answer

-Neer

Kuki123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hmanjarawala on: 2/23/2012 [Member] Bronze | Points: 25

Up
0
Down
Try this

On Print Button Click Event write
Page.ClinetScript.RegisterStartupScript(this.GetType(), "onclick", "Window.Print();", true);

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere
http://fieredotnet.wordpress.com/

Kuki123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kuki123 on: 2/23/2012 [Member] Starter | Points: 25

Up
0
Down
hi thanks but it is not working,

When i used the first option of neer it giving me an error
of The name 'printfosa_accounts' does not exist in the current context

and when used the second one option of Himanshu it giving an error of
'System.Web.UI.Page' does not contain a definition for 'ClinetScript'

please help

Kuki123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neer on: 2/23/2012 [Member] Starter | Points: 25

Up
0
Down
Can u post which page u want to print?

web page or project form?

-Neer

Kuki123, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kuki123 on: 2/23/2012 [Member] Starter | Points: 25

Up
0
Down
it is a web page


Kuki123, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response