隐藏我页面上的标签并将其显示在打印页面上(当点击按钮时) [英] hide label on my page and display it on print page' (when click button)

查看:77
本文介绍了隐藏我页面上的标签并将其显示在打印页面上(当点击按钮时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个文本框,一个标签和一个打印按钮,我正在寻找如何在我点击打印时将文本框的值分配给标签,文本框将消失(标签将取代它)只有标签将显示文本框分配的值,问题是当我点击打印按钮时,打印的页面出现并且不显示标签,但当我取消标签时,如果我理解客户端代码之前运行的代码,那么我的页面中会显示文本框的值,这不是我想要的:/。正常,文本框不会出现在打印页面hein !! :s

希望它很清楚

谢谢





hello,
I have a textbox and a label and a "print" button,im looking for how to assign the value of a the textbox to the label when i'll click on "print", and textbox will disappear(the label will take its place) only label will be displayed with the value assigned by the textbox , the problem is that when I click on "print" button ,the page that prints appear and does not show the label but when I cancel the label appears with the value of the textbox in my page if I understand the code behind runs before the client code it's not what i want :/. NORMAL, the textbox will not appear in the printed page hein!! :s
hope it's clear
thank you


$(".btnprint").click(function () {

              var value = $(".txtln").val();
              $("#lblln").html(value);
              return false;
          });










<asp:TextBox ID="TextBox_ln" runat="server" CssClass="txtln TextBox screenOnly"></asp:TextBox>
<asp:Label ID="lblln" ClientIDMode="Static" runat="server" Text=""></asp:Label>







<asp:ImageButton ID="btn_print" runat="server" Text="Print" OnClientClick="javascript : window.print();"
           OnClick="Button4_Click1" OnPreRender="btn_print_PreRender" CssClass="btnprint btn screenOnly"
           Style="margin-right: 30px; margin-top: 20px;" ImageUrl="~/images/print.png" OnUnload="btn_print_Unload"
           OnInit="btn_print_Init" OnLoad="btn_print_Load" />









代码落后:







code behind :

protected void Button4_Click1(object sender, EventArgs e)
       {
           ClientScript.RegisterStartupScript(this.GetType(), "PrintOperation", "printing()", true);
       }

推荐答案

(。btnprint)。click(function(){

var value =
(".btnprint").click(function () { var value =


(。txtln)。val();
(".txtln").val();


(#lblln)。html(value );
返回false;
});
("#lblln").html(value); return false; });










<asp:TextBox ID="TextBox_ln" runat="server" CssClass="txtln TextBox screenOnly"></asp:TextBox>
<asp:Label ID="lblln" ClientIDMode="Static" runat="server" Text=""></asp:Label>







<asp:ImageButton ID="btn_print" runat="server" Text="Print" OnClientClick="javascript : window.print();"
           OnClick="Button4_Click1" OnPreRender="btn_print_PreRender" CssClass="btnprint btn screenOnly"
           Style="margin-right: 30px; margin-top: 20px;" ImageUrl="~/images/print.png" OnUnload="btn_print_Unload"
           OnInit="btn_print_Init" OnLoad="btn_print_Load" />









代码落后:







code behind :

protected void Button4_Click1(object sender, EventArgs e)
       {
           ClientScript.RegisterStartupScript(this.GetType(), "PrintOperation", "printing()", true);
       }


这篇关于隐藏我页面上的标签并将其显示在打印页面上(当点击按钮时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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