Making a control visible on a seperate page, but not visible on the page which contains the control
I have a masterpa开发者_JAVA技巧ge (which we will call 'default'). This contains a second page (web user control) - 'second'. And finally a third 'print' page. The 'print' page is also a web user control, however, it merely has a placeholder that contains the 'second' page.
Is there a way I can add a control to the 'second' page - such as a literal, and only have it visible on the 'print' page?
It sounds like CSS will actually be the best approach to your issue. Use the media attribute to specify what is and what is not visible. Here's an example
<link rel="stylesheet" href="screen.css" media="screen">
which contains...
.yourClass
{
display:none;
}
and then also have:
<link rel="stylesheet" href="print.css" media="print">
which contains...
.yourClass
{
display:block;
}
So, your page would include both stylesheets, and your control would use the yourClass
CSS class. The end result would be that whatever elements use yourClass
would only be visible when printing.
精彩评论