Click here to Skip to main content
13,092,310 members (66,204 online)
Rate this:
Please Sign up or sign in to vote.
See more:

Can anybody solve my problem

How to get only data not with controls while printing a web page(.aspx) using printer.

for example a text box containing data sangeetha
when i press the print button the text box will disappear only data i.e, sangeetha should print.

Please help me out this.

Posted 29-Aug-12 1:33am
pranathis012 29-Aug-12 7:44am
better u can use Label's instead of TextBoxes.
Wes Aday 29-Aug-12 7:51am
This is really unclear. If you only want "sangeetha" then only print that. What makes you think that the text box will print? What do enabling controls on your page have to do with anything? Why would you need the textbox to magically disappear when the print button is pressed?
Marcus Kramer 29-Aug-12 9:46am
Please remove your email from your username, unless you like to receive lots of spam.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

1. Common way: Create completely new page that will contain only labels with the data you need printed. Format the page however you see fit. Add a button that will have @media print style display: none; The button should call javascript function window.print();

2. If you want to keep your page without having to create another: create CSS sheet with printing styles in which your text boxes and other controls have "border: none" and background-color = whatever your background color is (or set it to transparent) - that way only the data will be visible when printing.

If you want to know more google for "media dependant CSS".

If this helps please take time to accept the solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 19 Jan 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100