سلام
من توی asp.net یک گریدویو دارم که برای گزارش گیریه میخوام ببینم چجوری میتونم ازش پرینت بگیرم؟
طبق همون لینکی که دادید انجام دادم اینم کدهام ولی این خطا رو میده protected void print_Click(object sender, EventArgs e) { GridView1.UseAccessibleHeader = true; GridView1.HeaderRow.TableSection = TableRowSection.TableHeader; GridView1.FooterRow.TableSection = TableRowSection.TableFooter; GridView1.Attributes["style"] = "border-collapse:separate"; foreach (GridViewRow row in GridView1.Rows) { if (row.RowIndex % 10 == 0 && row.RowIndex != 0) { row.Attributes["style"] = "page-break-after:always;"; } } 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("<script type = 'text/javascript'>"); sb.Append("window.onload = new function(){"); sb.Append("var printWin = window.open('', '', 'left=0"); sb.Append(",top=0,width=1000,height=600,status=0');"); sb.Append("printWin.document.write(\""); string style = "<style type = 'text/css'>thead {display:table-header-group;} tfoot{display:table-footer-group;}</style>"; sb.Append(style + gridHTML); sb.Append("\");"); sb.Append("printWin.document.close();"); sb.Append("printWin.focus();"); sb.Append("printWin.print();"); sb.Append("printWin.close();"); sb.Append("};"); sb.Append("</script>"); ClientScript.RegisterStartupScript(this.GetType(), "GridPrint", sb.ToString()); GridView1.DataBind(); } public override void VerifyRenderingInServerForm(Control control) { /*Verifies that the control is rendered */ }
نمونه رو تست کردم مشکلی نداشت
مشکل از کدهای شماست
راه دیگه ای واسه پرینت نیست؟ من برای c# از استیمول سافت استفاده کردم ولی برای .net چیزی نمیدونم میخوام قابلیت گرافیکش خوب باشه
در Asp هم میتونید از Stimul استفاده کنید
اموزشی از استیمول برای asp ندارید؟ هر چی سرچ میزنم چیزی پیدا نمیکنم
این لینک رو ببینید
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)