感谢你阅读此帖.我的毕业设计要求能打印出当前GridView里面的数据,但我一直没有找到资料,
希望有这方面资料的各位朋友能发一份组件给我,最好是ddl和示范代码...本人邮箱:[email protected]提供链接也行..不胜感激!本人开发环境:VS2005Sp1,
asp.net2.0技术

解决方案 »

  1.   

    <script language="javascript">
    <!--
    function PrintNote()
    {
    var PrintWin=window.open('about:blank','Print');
    PrintWin.document.write('<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>' + document.all("PrintContent").innerHTML);
    PrintWin.document.all.WebBrowser.ExecWB(7,1);
    PrintWin.close();
    }
    -->
    </script>
    --------------------------------------------
    内容用<div>装起来,并把DIV设置ID
    <div id="PrintContent" align="center">
    your GridView
    </div>
    ------------------------------------
    <input onclick="javascript:PrintNote();" type="button" value="打印">
      

  2.   

    参考一下这个,看对你有没有启发
    http://blog.csdn.net/wdwgr/archive/2009/03/30/4036551.aspx
      

  3.   

    http://blog.csdn.net/hikaliv/archive/2009/05/18/4197181.aspx
    我有一个打印datagrid 的示例代码
      

  4.   

    wb.execwb(8,1); 
    wb.execwb(7,1); // 打印页面预览 
    wb.execwb(6,6); 也可导出打印
    参考
      

  5.   

    1 调用浏览器的打印功能
    2 把gridview导到excel or word中调它们的打印功能http://www.cnblogs.com/insus/articles/1400266.html
      

  6.   

    <input   type=button   value=打印           onclick= "document.all.WebBrowser.ExecWB(6,1) "   class= "NOPRINT "> 
    <input   type=button   value=直接打印   onclick= "document.all.WebBrowser.ExecWB(6,6) "   class= "NOPRINT "> 
    <input   type=button   value=页面设置   onclick= "document.all.WebBrowser.ExecWB(8,1) "   class= "NOPRINT "> 
    <input   type=button   value=打印预览   onclick= "document.all.WebBrowser.ExecWB(7,1) "   class= "NOPRINT "> 
    原来这个就是调用打印预览啊,
    先谢谢Js代码.谢谢