Last post Jan 09, 2015 01:53 AM by sandeep_sni
None
0 Points
5 Posts
Jun 21, 2013 07:03 AM|azeem_tariq|LINK
First you have to create a webpage and table that has to be print
<table id="myt" width = "100%" border ="2" frame ="box" rules ="all" cellpadding ="2">
set the ID= "SomeID" , "myt" in my case
a little java script
<script language="javascript" type ="text/javascript" > function printTbl() { var TableToPrint = document.getElementById('myt'); newWin = window.open(""); newWin.document.write(TableToPrint.outerHTML); newWin.print(); newWin.close(); } </script>
Create a button to print this table
<asp:Button ID="Button1" runat="server" OnClientClick ="printTbl()" />
"OnClientClick" call that javascript function "printTbl()"
Thats it...... Happy Coding............
Participant
1300 Points
407 Posts
Jun 21, 2013 08:16 AM|akhleshchauhan|LINK
place your table inside <div> tag and try to print div
<div id="divId">
</div>
<script language="javascript" type="text/javascript"> function PrintRadGrid(divId) { debugger; var divToPrint = document.getElementById(divId); var newWin = window.open('PrintDiv', 'Print-Window', 'width=920,height=750,top=100,left=100'); newWin.document.open(); newWin.document.write('<html><title>Invitation Status</title><head><style>#in {display:none}</style><body onload="window.print()">' + divToPrint.innerHTML + '</body></html>'); newWin.document.close(); setTimeout(function () { newWin.close(); }, 10); } </script>
Hope it helps you ...
Jun 23, 2013 08:40 AM|azeem_tariq|LINK
Thanks for reply
i was just posted an article ... it works fine for me so i thought i must share it on this forum as it may be helpful for others. any ways thanks again for posting it will give another idea to people.
1 Post
Jan 09, 2015 01:53 AM|sandeep_sni|LINK
this code is not print div with css it is printing unformat .i have apply inline css. please tell me solution which print with css.
div css javascript
None
0 Points
5 Posts
How TO Print Specific table from a webpage?
Jun 21, 2013 07:03 AM|azeem_tariq|LINK
First you have to create a webpage and table that has to be print
set the ID= "SomeID" , "myt" in my case
a little java script
Create a button to print this table
"OnClientClick" call that javascript function "printTbl()"
Thats it...... Happy Coding............
Participant
1300 Points
407 Posts
Re: How TO Print Specific table from a webpage?
Jun 21, 2013 08:16 AM|akhleshchauhan|LINK
place your table inside <div> tag and try to print div
<div id="divId">
</div>
Hope it helps you ...
Akhlesh Chauhan
None
0 Points
5 Posts
Re: How TO Print Specific table from a webpage?
Jun 23, 2013 08:40 AM|azeem_tariq|LINK
Thanks for reply
Akhlesh
i was just posted an article ... it works fine for me so i thought i must share it on this forum as it may be helpful for others. any ways thanks again for posting it will give another idea to people.
None
0 Points
1 Post
Re: How TO Print Specific table from a webpage?
Jan 09, 2015 01:53 AM|sandeep_sni|LINK
this code is not print div with css it is printing unformat .i have apply inline css. please tell me solution which print with css.
div css javascript