Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
<script type="text/javascript">
    function PrintGridData() {
        var prtGrid = document.getElementById('<%=searchedgrid.ClientID %>');
        var prtMenu = document.getElementById("<%=lblCurrentPath.ClientID %>").innerHTML;
        var prtwin = window.open('', 'PrintGridView', 'left=100,top=100,width=400,height=400,tollbar=0,scrollbars=1,status=0,resizable=1');
        if (prtMenu != null) {
            prtwin.document.write(prtMenu.outerHTML);
        }
        if (prtGrid != null) {
            prtwin.document.write(prtGrid.outerHTML);
        }
        prtwin.document.close();
        prtwin.focus();
        prtwin.print();
        prtwin.close();
    }
   </script> 


prtMenu got the value ... but at print window its showing undefined... What would be the error??
Posted
Updated 29-May-14 23:55pm
v2
Comments
Sriram Ramachandran 30-May-14 6:12am    
Actually I can print my gridview.. Its working fine... prtMenu(label)I need to print above the gridview which shows the value as undefined ... But prtMenu fetched the value correctly
Abhishek Pant 30-May-14 6:53am    
Take that label and gridview inside a div and try to print the div this will print both gridview and label too.
Sriram Ramachandran 30-May-14 6:54am    
let me try with that ...
SRS(The Coder) 17-Jun-14 2:22am    
You can keep the grid and print button in two separate DIVs and use 'jQuery.printArea.js' to print the div element content.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900