Dear Experts,
I'm facing a problem with ASPX user control,
I have design a html in user control
I wish to print their html design (html div or table), have added JavaScript as below, but this JavaScript not working in user control
----------------------
then i have modify this code as below
In code behind
protected void btnPrint_Click(object sender, EventArgs e)
{
btnPrint.Attributes.Add("onclick", "PrintDiv();");
}
Still not working
Please help us.

Mufid Bagdadi96 reputationPosted Jun 4, 2016, 1:06 AM EDT
function PrintPanel() {
var panel = document.getElementById("<%=pnlContents.ClientID %>");
var printWindow = window.open('', '', 'height=400,width=800');
printWindow.document.write('
printWindow.document.write('');
printWindow.document.write(panel.innerHTML);
printWindow.document.write('');
printWindow.document.close();
setTimeout(function () {
printWindow.print();
}, 500);
return false;
}
Muhammad Aqib ShehzadRank #379 · 6.7K reputationPosted Jun 3, 2016, 10:55 PM EDT
Manoj Patel8 reputationPosted Jun 4, 2016, 12:28 AM EDT
Manoj Patel8 reputationPosted Jun 4, 2016, 1:18 AM EDT
Mufid Bagdadi96 reputationPosted Jun 4, 2016, 1:29 AM EDT
Manoj Patel8 reputationPosted Jun 4, 2016, 1:39 AM EDT
Muhammad Aqib ShehzadRank #379 · 6.7K reputationPosted Jun 4, 2016, 2:24 AM EDT