The title is obvious i think. This is where i got some infos :
Provide Print functionality in ASP.NET MVC 4
How do I hide an element when printing a web page?
first, css :
@media print
{
.no-print, .no-print *
{
display: none !important;
}
}
so, in my cshtml :
<td style="max-width: 100px;"><a href="javascript:window.print()" class="btn btn-default">Print</a>
and now things i don't want to print :
<div style="top:120px;left:10px;position:absolute;" class="no-print"></div>
I also tried class="noPrint"
All's good, exept in the preview before printing i still see my menu...so i guess it WILL be printed... I use chrome.
Any idea ?