Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 11, 2012 06:23 AM by Abdul Muqeet
Member
82 Points
431 Posts
Sep 10, 2012 07:40 AM|LINK
i am trying to print PlaceHolder its showing this error ..
Here is my code
<head runat="server"> <script type = "text/javascript"> function PrintPanel() { var panel = document.getElementById("<%=pnlContents.ClientID %>"); var printWindow = window.open('', '', 'height=400,width=800'); printWindow.document.write('<html><head><title>DIV Contents</title>'); printWindow.document.write('</head><body >'); printWindow.document.write(panel.innerHTML); printWindow.document.write('</body></html>'); printWindow.document.close(); setTimeout(function () { printWindow.print(); }, 500); return false; } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server" Width="144px"></asp:TextBox> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> <asp:Panel id="pnlContents" runat = "server"> hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh <%-- <asp:PlaceHolder ID="plBarCode" runat="server" />--%> </asp:Panel> <br /> <asp:Button ID="btnPrint" runat="server" Text="Print" OnClientClick = "return PrintPanel()" /> <br /> <asp:PlaceHolder ID="plBarCode" runat="server" /> </div> </form> </body> </html>
Contributor
4289 Points
883 Posts
Sep 10, 2012 07:43 AM|LINK
Please go through these examples.. Also, put a debugger on the first line and debug the script.
http://www.codeproject.com/Articles/12033/using-javascript-create-printer-friendly-pages
http://www.javascriptkit.com/howto/newtech2.shtml
Sep 10, 2012 07:53 AM|LINK
i used this link...
http://aspsnippets.com/Articles/Print-ASPNet-Panel-contents-with-Print-Preview-using-JavaScript.aspx
Sep 11, 2012 06:23 AM|LINK
Microsoft JScript runtime error: Object expected
still i am getting the same error message
its working fine in one page .. and in my transaction page its showing this error message... i can figure it out ...
Abdul Muqeet
Member
82 Points
431 Posts
Error : Microsoft JScript runtime error: Object expected
Sep 10, 2012 07:40 AM|LINK
i am trying to print PlaceHolder its showing this error ..
Here is my code
<head runat="server"> <script type = "text/javascript"> function PrintPanel() { var panel = document.getElementById("<%=pnlContents.ClientID %>"); var printWindow = window.open('', '', 'height=400,width=800'); printWindow.document.write('<html><head><title>DIV Contents</title>'); printWindow.document.write('</head><body >'); printWindow.document.write(panel.innerHTML); printWindow.document.write('</body></html>'); printWindow.document.close(); setTimeout(function () { printWindow.print(); }, 500); return false; } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server" Width="144px"></asp:TextBox> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> <asp:Panel id="pnlContents" runat = "server"> hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh <%-- <asp:PlaceHolder ID="plBarCode" runat="server" />--%> </asp:Panel> <br /> <asp:Button ID="btnPrint" runat="server" Text="Print" OnClientClick = "return PrintPanel()" /> <br /> <asp:PlaceHolder ID="plBarCode" runat="server" /> </div> </form> </body> </html>Srikanth Kas...
Contributor
4289 Points
883 Posts
Re: Error : Microsoft JScript runtime error: Object expected
Sep 10, 2012 07:43 AM|LINK
Please go through these examples.. Also, put a debugger on the first line and debug the script.
http://www.codeproject.com/Articles/12033/using-javascript-create-printer-friendly-pages
http://www.javascriptkit.com/howto/newtech2.shtml
Srikanth Kasturi
Please "Mark As Answer" if my post serves purpose.
Abdul Muqeet
Member
82 Points
431 Posts
Re: Error : Microsoft JScript runtime error: Object expected
Sep 10, 2012 07:53 AM|LINK
i used this link...
http://aspsnippets.com/Articles/Print-ASPNet-Panel-contents-with-Print-Preview-using-JavaScript.aspx
Abdul Muqeet
Member
82 Points
431 Posts
Re: Error : Microsoft JScript runtime error: Object expected
Sep 11, 2012 06:23 AM|LINK
Microsoft JScript runtime error: Object expected
still i am getting the same error message
its working fine in one page .. and in my transaction page its showing this error message... i can figure it out ...