如何只打印太空数据并在Asp.Net中执行Dule Side打印? [英] How Print Only Spacific Data And Also Perform Dule Side Printing In Asp.Net ?

查看:64
本文介绍了如何只打印太空数据并在Asp.Net中执行Dule Side打印?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请朋友们。





我想从asp.net页面打印特定数据而不是整页,就像我只想打印一样来自十个领域的两个领域。



我还希望在页面两侧打印相同的选定数据...



请告诉我该怎么办。





请不要告诉我尝试自己或者不要'请说跟随链接这对我来说是新的,并且

i我在办公室的1周巨大压力下尝试这个....



帮助我out .......



等待你的回复.................

解决方案

如果您不愿意自己尝试或不遵循某些指南的链接,您对此有何期待?有人为你写代码吗?



对不起,但是你的上述观点让我偏离了轨道。请体谅,这里的人也有自己的工作,他们帮助别人,因为他们喜欢帮助。



无论如何,在这种情况下,要么你需要打开一个将数据与您需要打印的页面分开,然后使用window.print()。



或者按照http://stackoverflow.com/questions/18323435/printing-an-asp-net-web-site-page [ ^ ]



然后你可以打印特定元素或CSS3的内容,按照最后的答案。



希望帮助


根据我的说法,最简单的方法是使用一个面板并将控件(你想要打印)放在里面。使用这样的按钮(面板外)

< asp:按钮ID =Button2runat =serverText =Print
OnClientClick = return PrintPanel(); Enabled =False/>



它有一个javascript函数OnClientClick,它将执行打印作业。

此函数的javascript函数将是

 <   script     type     =  text / javascript >  
function PrintPanel(){
var panel = document.getElementById(<% = Panel1.ClientID %> );
var printWindow = window.open('','','height = 400,width = 800');
printWindow.document.write(panel.innerHTML);
printWindow.document.close();
setTimeout(function(){
printWindow.print();
},500);
返回false;
}
< / script >



您可以根据您的要求进行更改。

希望这会有所帮助..快乐编码! :)


Please Friends.


I want to print specific data from asp.net page not full page like i want to print only two field from ten field.

and also i want to print same selected data on both side of page ...

Please tell me how can i do.


Please don't tell me to try my own or don't say follow link this is new for me and
i am trying this from 1 week huge pressure in office....

help me out.......

waiting for your reply.................

解决方案

If you are not willing to try at your own or not follow a link with some guidelines, what exactly do you expect? Someone to write code for you?

Sorry, but the framing of your above point got me off-track. Please be considerate, people here are too having their own work and they help others because they like to help.

Anyway, in this case, either you need to open a separate page with data whatever you need to print and then use window.print().

Or as suggested at http://stackoverflow.com/questions/18323435/printing-an-asp-net-web-site-page[^]

You can then print content of particular element or with CSS3, follow the last answer.

Hope that helps


The easiest way to do, according to me, is to use a panel and put the controls(which you want to print) inside it. Use a button(outside the panel) like this

<asp:Button ID="Button2" runat="server" Text="Print" 
            OnClientClick = "return PrintPanel();" Enabled="False"/>


It has a javascript function OnClientClick which will do the printing job.
The javascript function for this will be

<script type = "text/javascript">
        function PrintPanel() {
            var panel = document.getElementById("<%=Panel1.ClientID %>");
            var printWindow = window.open('', '', 'height=400,width=800');
            printWindow.document.write(panel.innerHTML);
            printWindow.document.close();
            setTimeout(function () {
                printWindow.print();
            }, 500);
            return false;
        }
    </script>


You may change it as per your requirement.
Hope this helps.. Happy Coding! :)


这篇关于如何只打印太空数据并在Asp.Net中执行Dule Side打印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆