【问题标题】:print page in asp.net without master page's controls在没有母版页控件的 asp.net 中打印页面
【发布时间】:2012-04-27 18:44:17
【问题描述】:

我想打印我的页面接受 masterpage 的元素。母版页中有一个用户控件,这对我很重要。我的打印按钮也在母版页上。 谢谢..

【问题讨论】:

    标签: asp.net printing


    【解决方案1】:

    您需要创建新的样式表 print.css 并设置 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”类添加到您要打印的部分

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

    更多详情:http://www.codeproject.com/KB/HTML/Printing_with_CSS.aspx

    【讨论】:

      【解决方案2】:

      您可以设置打印样式表来格式化打印内容/您可以隐藏不想打印的内容。

      您可以在此处http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml 阅读有关它们的更多信息

      【讨论】:

        猜你喜欢
        • 2023-03-06
        • 2013-03-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-04-12
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多