Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi experts,

I have one grid view am trying to print that grid view using javascript,
but the grid contains footer roe and image's in the first column. i want to hide the images and footer row while printing . can any one please help me to solve this issue

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



...and the grid view is




thanks in advance
(Keerthi Kumar)
Posted
Updated 27-May-14 20:29pm
v3
Comments
anuradha.sardesai 28-May-14 3:11am    
What kind of grid are you using?
Keerthi Kumar(Andar) 28-May-14 3:15am    
asp grid and its code is

<asp:GridView ID="grdPurchaseOrderItem" Style="width: 98%;" runat="server" AutoGenerateColumns="false"
CssClass="Grid" EmptyDataText="There are no data records to display." PagerStyle-CssClass="pgr"
PageSize="5" ShowFooter="true" OnRowCancelingEdit="grdPurchaseOrderItem_RowCancelingEdit"
OnRowDeleting="grdPurchaseOrderItem_RowDeleting" OnRowEditing="grdPurchaseOrderItem_RowEditing"
OnRowUpdating="grdPurchaseOrderItem_RowUpdating" OnRowCommand="grdPurchaseOrderItem_RowCommand">
<columns>
<asp:TemplateField>
<edititemtemplate>
<asp:ImageButton ID="imgbtnUpdate" CommandName="Update" runat="server" ImageUrl="~/Images/update.jpg"
ToolTip="Update" Height="20px" Width="20px" />
<asp:ImageButton ID="imgbtnCancel" runat="server" CommandName="Cancel" ImageUrl="~/Images/Cancel.jpg"
ToolTip="Cancel" Height="20px" Width="20px" />

<itemtemplate>
<asp:ImageButton ID="imgbtnEdit" CommandName="Edit" runat="server" ImageUrl="~/Images/Edit.jpg"
ToolTip="Edit" Height="20px" Width="20px" />
<asp:ImageButton ID="imgbtnDelete" CommandName="Delete" Text="Edit" runat="server"
ImageUrl="~/Images/delete.jpg" ToolTip="Delete" Height="20px" Width="20px" OnClientClick="return confirm('Are you sure you want to Delete?')" />

<footertemplate>
<asp:ImageButton ID="imgbtnAdd" runat="server" ImageUrl="~/Images/AddNewitem.jpg"
CommandName="AddNew" Width="30px" Height="30px" ToolTip="Add new Item Details."
ValidationGroup="validaiton" />


<asp:TemplateField HeaderText="Item Code">
<itemstyle horizontalalign="Center">
<itemstyle verticalalign="Middle">
<edititemtemplate>
<asp:DropDownList ID="ddleditItemCode" runat="server" OnSelectedIndexChanged="ddleditItemCode_SelectedIndexChanged"
AutoPostBack="true">


<itemtemplate>
<asp:Label ID="lblitemCode" runat="server" Text='<%#Eval("idItemCode") %>' />

<footertemplate>
<asp:DropDownList ID="ddlItemCode" runat="server" OnSelectedIndexChanged="ddlItemCode_SelectedIndexChanged"
AutoPostBack="true">



<asp:TemplateField Visible="false">

1 solution

 
Share this answer
 
Comments
Keerthi Kumar(Andar) 28-May-14 7:10am    
is there any other way??

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