![]() |
| ||
| How to print specified contents in .NET 2.0? I want to print the page in C#/ASP.NET 2.0, but the problem is when i use following javascript code, it prints the whole page. function printMe() { window.print(); document.getElementById("printed").value = "YES"; document.getElementById("form1").submit(); } <formid="form1"runat="server"> <input type="button" value="Print me" onclick="printMe();" /> <input type="hidden" id="printed" /> I don't want to print the complete page but i just want to print the contents of the page only. Do anybody have any idea? Thanks in advance |
| ||
| Re: How to print specified contents in .NET 2.0? You have a couple of choices depending on how many elements you require to print. There is no 'builtin' solution for this kind of thing in ASP.NET look into CSS <style type="text/css" media="print">#elementid {display; none;}</style>You can have a separate style sheet for the browser to apply when printing, which hides any elements you don't want in the print out, by applying display: none style to them.The other option is appending the elements you want printed into an iFrame thats positioned out of site in the page and print from that. |
| All times are GMT -4. The time now is 9:54 pm. |
Forum system based on vBulletin Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
©2003 - 2010 DaniWeb® LLC