在asp.net中打印完整的textboxdata

时间:2014-06-05 14:16:02

标签: c#

我的应用程序,如果用户想要打印特定数据。它打印特定内容,但带有多行数据的文本框出现问题。无论用户在文本框中输入什么内容,都不会打印完整数据。

下面是代码

<script>

function printDiv(divID) {
            //Get the HTML of div

            var divElements = document.getElementById(divID).innerHTML;

            //Get the HTML of whole page

            var oldPage = document.body.innerHTML;

            //Reset the page's HTML with div's HTML only
            document.body.innerHTML = 
              "<html><head><title>Timesheet Details</title></head><body>" +

              divElements + "</body>";

            //Print Page

            window.print();

            //Restore orignal HTML

            document.body.innerHTML = oldPage;


        }
    </script>

 <div>
       <asp:ImageButton ID="ImageButton1"  Text="Print" runat="server" ImageUrl="~/images/print.jpg"

 OnClientClick="javascript:printDiv('printablediv')" />

       <asp:Label ID="Label3" runat="server" Font-Bold="true" Font-Size="Small" ForeColor="Red"

  Text="Print your Timesheet"></asp:Label>

    </div>

     <div id = "printablediv">

       //content

empnamelabel文本框     startdate文本框      enddate textbox

sun servicesundaytextbox1 sunvenutextbox2 starttimetextbox endtimetextbox totaltimetextbox

mon servicemontextbox1 monvenutextbox2 monstarttimetextbox monendtimetextbox montotaltimetextbox

tue tueservicetextbox1 tuevenutextbox2 tuestarttimetextbox tueendtimetextbox tuetotaltimetextbox

wed wedservicetextbox1 wedvenutextbox2 wedstarttimetextbox wedendtimetextbox wedtotaltimetextbox

......周六......

0 个答案:

没有答案