Click here to Skip to main content
15,881,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
In form1.aspx am rendering form2.aspx page data as below:

<cc1:CEWebFormRenderer ID="RNDR1" CssClass="content-container-float" Width="900px"
Height="495px" runat="server" HostDomain="." HostLogin="ABSuite" HostPassword="Dulc1n3a"
HostURI="x-ratl:localhost:2449" Overflow="visible" >

<UniMenuControl:UniMenu ID="UniMenu1" ToolTip="Context Menu" ShowAtDesignTime="False"
RolloverColor="LightGoldenrodYellow" BorderStyle="Outset" runat="server">
<unimenucontrol:unimenuitem tooltip="Change to another ispec" commandname="SelectIspec" xmlns:unimenucontrol="#unknown">
Text="Select a Form">
<unimenucontrol:unimenuitem tooltip="Look at any messages or errors from the application." xmlns:unimenucontrol="#unknown">
CommandName="ViewMessages" Text="View Messages/Errors">
<unimenucontrol:unimenuitem tooltip="Change to another language" commandname="ChangeLanguage" xmlns:unimenucontrol="#unknown">
Text="Change Language">
<unimenucontrol:unimenuitem xmlns:unimenucontrol="#unknown">
<unimenucontrol:unimenuitem tooltip="Display and interact with the Console window" xmlns:unimenucontrol="#unknown">
CommandName="Console" Text="Show Console">
<unimenucontrol:unimenuitem tooltip="Send the Form to the Printer" commandname="Print" xmlns:unimenucontrol="#unknown">
Text="Print Form">
<unimenucontrol:unimenuitem tooltip="Send the form data to the host application" xmlns:unimenucontrol="#unknown">
CommandName="Transmit" Text="Transmit Form">
<unimenucontrol:unimenuitem tooltip="Close the current Session" commandname="Close" xmlns:unimenucontrol="#unknown">
Text="Close Session">



Then in form1.aspx I have used javascript function PrintPage() call to print div "Table1" contents which is as below:
function PrintPage() {
var tbl1 = document.getElementById('Table1').outerHTML;
var sFeatures = "dialogWidth=800px;dialogHeight=555px;border=thick;center=yes;help=no;status=no;resize=1;scroll=1";
window.dialogParameter1 = tbl1;
var retval = window.showModalDialog('PrintForm.aspx', window, sFeatures);
}

In printform.aspx:
<style media="all" type="text/css">
#printTblDiv {
display: block;
width: 80%;
page-break-inside: auto;
vertical-align: top;
padding-top: 74px;
}
</style>
<script type="text/javascript">
window.dialogParent = dialogArguments;
var Test = dialogParent.dialogParameter1;
function onLoadBody() {
document.getElementById('printTblDiv').innerHTML = Test;
print();
}
</script>

But all that it prints is good execpt that the grid table rows print in 2nd page are floating to right and few columns are cut.

Please help me resolve this issue. Find the screen shots.

Thanks in Advance !! :)

What I have tried:

function PrintPage() {
var tbl1 = document.getElementById('Table1').outerHTML;
var sFeatures = "dialogWidth=800px;dialogHeight=555px;border=thick;center=yes;help=no;status=no;resize=1;scroll=1";
window.dialogParameter1 = tbl1;
var retval = window.showModalDialog('PrintForm.aspx', window, sFeatures);
}

In printform.aspx:
<style media="all" type="text/css">
#printTblDiv {
display: block;
width: 80%;
page-break-inside: auto;
vertical-align: top;
padding-top: 74px;
}
</style>
<script type="text/javascript">
window.dialogParent = dialogArguments;
var Test = dialogParent.dialogParameter1;
function onLoadBody() {
document.getElementById('printTblDiv').innerHTML = Test;
print();
}
</script>
Posted
Updated 27-May-16 4:04am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900