Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii to all,
there is a problem in my application , actually i am generating a report using asp.net , there are some div and other elements , like div1 div2 div3 , in div2 i am binding some data , what i want that when i give the print command through my keyboard , it should show only div2 data others like div1 and div2 should be hidden .

i have tried with so many code like with java script and css , but not getting a proper ans , please help me out ,

thanks to all .
Posted

1 solution

Supposing the divs you want to hide on printing have ids "div1", "div2" etc, all you have to do is put a style block like:

HTML
<style>
@media print {
    #div1, #div2 {
        display: none;
    }
}
</style>


or whatever css selectors to find your divs.
 
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