Note that there are some explanatory texts on larger screens.

plurals
  1. POprinting problem in asp.net webapplication
    primarykey
    data
    text
    <p>i am using following code for print the content of Webapplication - </p> <pre><code>using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; using System.Text; using System.Web.SessionState; public class PrintHelper { public PrintHelper() { } public static void PrintWebControl(Control ctrl) { PrintWebControl(ctrl, string.Empty); } public static void PrintWebControl(Control ctrl, string Script) { StringWriter stringWrite = new StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite); if (ctrl is WebControl) { Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w; } Page pg = new Page(); pg.EnableEventValidation = false; if (Script != string.Empty) { pg.ClientScript.RegisterStartupScript(pg.GetType(),"PrintJavaScript", Script); } HtmlForm frm = new HtmlForm(); pg.Controls.Add(frm); frm.Attributes.Add("runat", "server"); frm.Controls.Add(ctrl); pg.DesignerInitialize(); pg.RenderControl(htmlWrite); string strHTML = stringWrite.ToString(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(strHTML); HttpContext.Current.Response.Write("&lt;script&gt;window.print();&lt;/script&gt;"); HttpContext.Current.Response.End(); } } </code></pre> <p>here i pass the textbox control to PrintWebControl() method.</p> <p>on print button click i write - </p> <pre><code>protected void btnPrint_Click(object sender, EventArgs e) { Session["ctrl"] = Panel1; ClientScript.RegisterStartupScript(this.GetType(), "onclick", "&lt;script language=javascript&gt;window.open('Print.aspx','PrintMe','height=300px,width=300px,scrollbars=1');&lt;/script&gt;"); } </code></pre> <p>now problem is that when i run this application and press on print button then only half of matter of multiline textbox is printed by the printer but rest part not.</p> <p>so tell me how i print the multiline textbox using above code. Note my multiline textbox has huge data which will print on more than 4 or 5 page.</p> <p>if you have another code for do it please share with me</p> <p>thank to all of you in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload