Loading

Printing in ASP.NET

Submitted by: 
Visitors have accessed this post 5265 times.


In windows desktop application it is easy to print a form data for report or other purpose but in asp.net web form it is not easy to print a page.
The printing on client side needs solutions for different conditions
using JavaScript

The simplest way to print a web form is to use client side JavaScript. To print a web page, you can use code like this:

  1. <input type="button" value="Print" onclick="window.print();">

this will print whole page including print button and this can be useful in some case.For making it more professional you can make two version of web page one for the scree and another for the printing purpose. result will be that your print button will open print version in another window and call windows.print() method when page loads

About the author:

PlanetSourceCode.in is a place for all developer providing free source codes, articles, complete projects,complete application in PHP, C/C++, Javascript, Visual Basic, Cobol, Pascal, ASP/VBScript, AJAX, SQL, Perl, Python, Ruby, Mobile Development




Add new comment

(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
To prevent automated spam submissions leave this field empty.