One option is to use a pop up a new page with content to be printed (text box text) passed from the current page and let the user print it from the pop up page.
Mark replies as answers if they helped you solve the problem.
</head>
<body>
<form id="form1" runat="server">
<div id="WithoutPrint">
This area will not print!
</div>
<div id="Print"> <!--startprint-->
This area will print!
<!--endprint-->
</div>
<input id="btnPrint" type="button" value="Print" onclick="doPrint()" />
</form>
</body>
</html>
Let me know if I have misunderstood what you mean. Thanks.
thank you for help, but I didnt want to print apart of page, the case that I have a textbox servercontrol with multiline , and I want to enable user to print the content of it.
khalid2008
Member
69 Points
221 Posts
print textArea
Mar 17, 2008 12:21 PM|LINK
hi all,
I have textbox with multiline property and I want to enable user to print the content of it so what can I do to accomplish that.
thanks in advance to everyone help me
khalid
siva_sm
Star
9393 Points
1372 Posts
Re: print textArea
Mar 17, 2008 12:39 PM|LINK
sandynaidu
Member
314 Points
139 Posts
Re: print textArea
Mar 17, 2008 12:51 PM|LINK
Take this i hope thing one might help you.
http://www.c-sharpcorner.com/UploadFile/mgold/NotepadDotNet07312005142055PM/NotepadDotNet.aspx?ArticleID=f0d1979f-e07d-4820-9f10-cbd52cdc2c8d
Hong-Gang Ch...
All-Star
74695 Points
6767 Posts
Microsoft
Re: print textArea
Mar 20, 2008 03:41 AM|LINK
Base on my understanding, you want to print part of the page, right?
If so, please refer the following demo:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Print Demo</title>
<script language="javascript" type="text/javascript">
function doPrint() {
bdhtml=window.document.body.innerHTML;
sprnstr="<!--startprint-->";
eprnstr="<!--endprint-->";
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
window.document.body.innerHTML=prnhtml;
window.print();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="WithoutPrint">
This area will not print!
</div>
<div id="Print">
<!--startprint-->
This area will print!
<!--endprint-->
</div>
<input id="btnPrint" type="button" value="Print" onclick="doPrint()" />
</form>
</body>
</html>
Let me know if I have misunderstood what you mean. Thanks.
Hope it helps,
Hong Gang
If you have any feedback about my replies,please contactmsdnmg@microsoft.com.
Microsoft One Code Framework
khalid2008
Member
69 Points
221 Posts
Re: print textArea
Mar 26, 2008 10:46 AM|LINK
hi Hong Gang,
thank you for help, but I didnt want to print apart of page, the case that I have a textbox servercontrol with multiline , and I want to enable user to print the content of it.
could you help me ?????
thanks in advace
khalid
khalid2008
Member
69 Points
221 Posts
Re: print textArea
Mar 26, 2008 01:47 PM|LINK
hi Hong Gang,
thanks in advance , your code solved my problem.
khalid