Printing in Asp.net
How to print invoice/Bill using dot matrix printers using C#?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bhuvanesh MohankumarPosted May 14, 2016, 3:39 AM
protected void PrintCurrentPage(object sender, EventArgs e)
{
GridView1.PagerSettings.Visible = false;
GridView1.DataBind();
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
GridView1.RenderControl(hw);
string gridHTML = sw.ToString().Replace("\"", "'")
.Replace(System.Environment.NewLine, "");
StringBuilder sb = new StringBuilder();
sb.Append("");
ClientScript.RegisterStartupScript(this.GetType(), "GridPrint", sb.ToString());
GridView1.PagerSettings.Visible = true;
GridView1.DataBind();
}