Hi sir
I need to print text box value and barcode in asp.net. I am using the below code.the barcode display correct but text box value is clear.
What I have tried:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script language="javascript" type="text/javascript">
if (window.print) {
document.write('<form><input type=button name=print value="Print" ></form>');
}
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> </head><body>" + divElements + "</body>";
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = oldPage;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text="no"><asp:TextBox ID="TextBox1" runat="server">
<asp:Label ID="Label2" runat="server" Text="bnb"> <asp:TextBox ID="TextBox2" runat="server">
<asp:Label ID="Label3" runat="server" Text="hjh"><asp:TextBox ID="TextBox3" runat="server">
<asp:Label ID="Label4" runat="server" Text="bar"><telerik:RadBarcode runat="server" ID="RadBarcode1" Type="Code11" Text="123" Font-Size="16px"
LineWidth="4" Height="32px" Style="margin-left: 75px" Width="131px" ShowChecksum="False"
ShowText="False">
<asp:Button ID="Button2" runat="server" Text="Print" OnClientClick=" javascript:printDiv('importDiv')" />
</form>
</body>
</html>