Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何打印html表服务器控件_Html_Asp.net_Printing - Fatal编程技术网

如何打印html表服务器控件

如何打印html表服务器控件,html,asp.net,printing,Html,Asp.net,Printing,我遇到了一点麻烦,我需要打印一个从C#加载的HtmlTable,但是看了一眼之后,我意识到我的javascript打印函数只有在HtmlTable没有runat=“server”时才起作用,不幸的是,这意味着我无法使用C#加载它。。。那么如何打印从C#加载的HtmlTable呢?javascript打印函数如下所示。欢迎任何帮助 function Print() { var prntData = document.getElementById('Table1'); var myw

我遇到了一点麻烦,我需要打印一个从C#加载的HtmlTable,但是看了一眼之后,我意识到我的javascript打印函数只有在HtmlTable没有runat=“server”时才起作用,不幸的是,这意味着我无法使用C#加载它。。。那么如何打印从C#加载的HtmlTable呢?javascript打印函数如下所示。欢迎任何帮助

function Print() {
    var prntData = document.getElementById('Table1');
    var mywindow = window.open('', 'printer', 'height=400,width=600');
    mywindow.document.write('<html><head><title></title>');
    mywindow.document.write('</head><body style="direction:rtl;"><pre>');
    mywindow.document.write(prntData.innerHTML);
    mywindow.document.write('</pre></body></html>');
    mywindow.document.close();
    mywindow.print();
}
函数打印(){
var prntData=document.getElementById('Table1');
var mywindow=window.open(“”,'printer','height=400,width=600');
mywindow.document.write(“”);
mywindow.document.write(“”);
mywindow.document.write(prntData.innerHTML);
mywindow.document.write(“”);
mywindow.document.close();
mywindow.print();
}