Printing 在Asp.net的数据列表中打印产品信息时,图像不显示
我使用面板来保存数据列表 用于在数据列表中显示img的aspx代码Printing 在Asp.net的数据列表中打印产品信息时,图像不显示,printing,Printing,我使用面板来保存数据列表 用于在数据列表中显示img的aspx代码 <asp:Image ID="Image2" ImageUrl='<%# Eval("FilePath") %>' Width="120px" Height="180px" runat="server" /> 代码隐藏: StringWriter sw = new System.IO.StringWriter(); HtmlTextWriter hw = new HtmlTex
<asp:Image ID="Image2" ImageUrl='<%# Eval("FilePath") %>' Width="120px" Height="180px" runat="server" />
代码隐藏:
StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
panel.RenderControl(hw);
string html = 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(\"");
sb.Append(html);
sb.Append("\");");
sb.Append("printWin.document.close();");
sb.Append("printWin.focus();");
sb.Append("printWin.print();printWin.opener.location.href=printWin.opener.location.href;");
sb.Append("printWin.close();};");
sb.Append("</script>");
ClientScript.RegisterStartupScriptthis.GetType、Print、sb.ToString