Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
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 29-Aug-12 2:33am
Comments
Wes Aday at 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 at 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
good
Please Sign up or sign in to vote.

Solution 1

Look into media-queries for CSS and the "print" option.
 
This way you can specify what elements will be visible and not during a print operation.
 
For example:
@media print {
    #myHeader, #myFooter, #myNav {
        display: none !important;
    }
    /* ... */
}
For this specific case you can dress the textbox with a rule that takes away the borders and set the background to white or transparent:
@media print {
    #idOfTheTextbox {
        border:none !important;
        background:transparent !important;
        /* ... */
    }
}
If you cannot easily get the id of the textbox you can of course use a class instead.
 
Set class for example 'dontPrintTextbox' on the textbox and use:
@media print {
    .dontPrintTextbox {
        border:none ! important;
        background:transparent !important;
        /* ... */
   }
}
Adjust as needed.
  Permalink  
v2

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



Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 16 Apr 2013
Copyright © CodeProject, 1999-2014
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