在asp.net中打印此页无母版页的控制 [英] print page in asp.net without master page's controls

查看:133
本文介绍了在asp.net中打印此页无母版页的控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要打印我的网页接受母版的元素。有在母版的用户控件,这对我来说是很重要的。也是我的打印按钮是母版页上。
感谢..

I want to print my page accept the elements of masterpage. there is a user control in masterpage and it is important for me. also my print button is on master page. thanks..

推荐答案

您需要创建新的样式表,print.css并设置CSS媒体=打印

You require to create new style sheet print.css and set CSS media=print

例如:

<style media="screen">
  .noPrint{ display: block; }
  .yesPrint{ display: block !important; }
</style>

<style media="print">
  .noPrint{ display: none; }
  .yesPrint{ display: block !important; }
</style>

和添加类yesPrint你要打印的部分。

and add class to "yesPrint" to the sections you want to print

  <asp:ContentPlaceHolder class="yesPrint" id="MainContent" runat="server">
  </asp:ContentPlaceHolder>

有关更多detatil: HTTP://www.$c$cproject。 COM / KB / HTML / Printing_with_CSS.aspx

for more detatil : http://www.codeproject.com/KB/HTML/Printing_with_CSS.aspx

这篇关于在asp.net中打印此页无母版页的控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆