How to Print Grid View in SharePoint

step 1:  Create  html button

<input type="button" value="Print " id="bbtnPrint" runat="Server" onclick="javascript:CallPrint('name')"  visible="false"/>

Step 2: in the div tag use  grid-view

<div id=”name”>
    <table>

    </table>
</div>

step 3:Function Call

<script type="text/javascript">
function CallPrint(strid)
     {
         var prtContent = document.getElementById(strid);
         var WinPrint = window.open('', '', 'letf=0,top=0,width=600,height=500,toolbar=0,scrollbars=0,status=0');
         WinPrint.document.write(prtContent.innerHTML);
         WinPrint.document.close();
         WinPrint.focus();
         WinPrint.print();
         WinPrint.close();
     }

</script>

Comments

Post a Comment

Popular posts from this blog

Activating a SharePoint Feature on Multiple Sites or Site Collections using PowerShell

Managed Path with WildCard and Explicit Inclusion

List All SharePoint 2010 PowerShell Commands