Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

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.


Regards,
Sangeetha.
Posted
Comments
[no name] 29-Aug-12 7:44am    
better u can use Label's instead of TextBoxes.
[no name] 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?
fjdiewornncalwe 29-Aug-12 9:46am    
Please remove your email from your username, unless you like to receive lots of spam.

1 solution

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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900