how to print the contents of text box

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: how to print the contents of text box

 
0
  #11
Dec 10th, 2008
Originally Posted by 4advanced View Post
hmm... did you read my last post serkansendur?
yes i did, but isnt it too long? you are going to scare him and he will quit programming soon.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 63
Reputation: 4advanced is an unknown quantity at this point 
Solved Threads: 10
4advanced 4advanced is offline Offline
Junior Poster in Training

Re: how to print the contents of text box

 
0
  #12
Dec 11th, 2008
from the conversiontool

http://www.developerfusion.com/tools.../vb-to-csharp/

  1. protected void // ERROR: Handles clauses are not supported in C# Page_Load(object sender, System.EventArgs e)
  2. {
  3. System.Text.StringBuilder sPrintScript = new System.Text.StringBuilder();
  4. sPrintScript.Append("<script type='text/javascript'>").AppendLine("");
  5. sPrintScript.Append("<!--").AppendLine("");
  6. sPrintScript.Append("function printText(elementId)").AppendLine("");
  7. sPrintScript.Append("{").AppendLine("");
  8. sPrintScript.Append("var printContent = document.getElementById(elementId);").AppendLine("");
  9. sPrintScript.Append("var windowUrl = 'about<b></b>:blank';").AppendLine("");
  10. sPrintScript.Append("var windowName = 'Print' + new Date().getTime();").AppendLine("");
  11. sPrintScript.Append("var sTextToPrint = printContent.innerHTML;").AppendLine("");
  12. sPrintScript.Append("var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');");
  13. sPrintScript.AppendLine("");
  14. sPrintScript.Append("printWindow.document.write(sTextToPrint);").AppendLine("");
  15. sPrintScript.Append("printWindow.document.close();").AppendLine("");
  16. sPrintScript.Append("printWindow.focus();").AppendLine("");
  17. sPrintScript.Append("printWindow.print();").AppendLine("");
  18. sPrintScript.Append("printWindow.close();").AppendLine("").Append("}").AppendLine("");
  19. sPrintScript.Append("// -->").AppendLine("");
  20. sPrintScript.Append("</script>");
  21. if (!ClientScript.IsClientScriptBlockRegistered("printText")) ClientScript.RegisterClientScriptBlock(this.GetType(), "printText", sPrintScript.ToString);
  22. Button1.Attributes.Add("onclick", string.Format("return printText('{0}');", this.TextBox1.ClientID));
  23. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC