| | |
how to print the contents of text box
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 63
Reputation:
Solved Threads: 10
from the conversiontool 
http://www.developerfusion.com/tools.../vb-to-csharp/

http://www.developerfusion.com/tools.../vb-to-csharp/
ASP.NET Syntax (Toggle Plain Text)
protected void // ERROR: Handles clauses are not supported in C# Page_Load(object sender, System.EventArgs e) { System.Text.StringBuilder sPrintScript = new System.Text.StringBuilder(); sPrintScript.Append("<script type='text/javascript'>").AppendLine(""); sPrintScript.Append("<!--").AppendLine(""); sPrintScript.Append("function printText(elementId)").AppendLine(""); sPrintScript.Append("{").AppendLine(""); sPrintScript.Append("var printContent = document.getElementById(elementId);").AppendLine(""); sPrintScript.Append("var windowUrl = 'about<b></b>:blank';").AppendLine(""); sPrintScript.Append("var windowName = 'Print' + new Date().getTime();").AppendLine(""); sPrintScript.Append("var sTextToPrint = printContent.innerHTML;").AppendLine(""); sPrintScript.Append("var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');"); sPrintScript.AppendLine(""); sPrintScript.Append("printWindow.document.write(sTextToPrint);").AppendLine(""); sPrintScript.Append("printWindow.document.close();").AppendLine(""); sPrintScript.Append("printWindow.focus();").AppendLine(""); sPrintScript.Append("printWindow.print();").AppendLine(""); sPrintScript.Append("printWindow.close();").AppendLine("").Append("}").AppendLine(""); sPrintScript.Append("// -->").AppendLine(""); sPrintScript.Append("</script>"); if (!ClientScript.IsClientScriptBlockRegistered("printText")) ClientScript.RegisterClientScriptBlock(this.GetType(), "printText", sPrintScript.ToString); Button1.Attributes.Add("onclick", string.Format("return printText('{0}');", this.TextBox1.ClientID)); }
![]() |
Similar Threads
- How to print contents inVB.Net (VB.NET)
- copying the contents of richtext box with same font (C#)
- using rich text box to print its contents (C#)
- read-delete lines from a text file (PHP)
- VB Advanced TEXT BOX problems (Visual Basic 4 / 5 / 6)
- i have this on my XP desktop:TROJAN-SPY.HTML.SMITFRAUD.c (Viruses, Spyware and other Nasties)
- Trojan-Spy.HTML.Smitfraud.c (Viruses, Spyware and other Nasties)
- Want to use radio button or menu bar instead of combo box (Java)
Other Threads in the ASP.NET Forum
- Previous Thread: Master/Detail DropDownList and DataGrid
- Next Thread: error while i am writing the code to file upload
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dropdownmenu dynamic edit embeddingactivexcontrol expose feedback findcontrol flash flv form formatdecimal forms formview gridview homeedition hosting iframe iis javascript jquery list menu mono mssql multistepregistration nameisnotdeclared novell objects order problem ratings rotatepage save search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking treeview typeof unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment wizard xml youareanotmemberofthedebuggerusers






