Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 487051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:33:56+00:00 2026-05-13T01:33:56+00:00

I am printing out a Gridview along with a Title. I don’t print anything

  • 0

I am printing out a Gridview along with a Title. I don’t print anything else on the page. That works fine. However I have a cell that is a template field that i do not want to Print. How can I exclude that cell? Here is some code that I have.

<div id="Printmeonly" align="center">
<table width="100%">
    <tr id="trtitle" style="display:none">
        <td style="color:Blue;font-size:large" align="center" colspan="2"><strong>Incident # <%=Request.QueryString["Inc"].ToString() %> Notes (Store <%=Request.QueryString["Loc"].ToString() %>)</strong><br /><br /></td>
    </tr>
    <tr>
        <td colspan="2" align="center">
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
                CellPadding="3"
                DataSourceID="SqlDataSource" ShowFooter="True">
                <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                <Columns>
                     <asp:BoundField DataField="Somefield" HeaderText="Somefield" 
                         SortExpression="Somefield" Visible="False" />
                     <asp:TemplateField ShowHeader="True" HeaderText="Action" ItemStyle-CssClass="dontPrint"  ControlStyle-CssClass="dontPrint" HeaderStyle-CssClass="dontPrint" FooterStyle-CssClass="dontPrint">
                     <ItemTemplate>
                         <asp:ImageButton ID="bttneditNote" ImageUrl="~/images/bttnEdit.gif" style="cursor:pointer" runat="server" CausesValidation="False" 
                             CommandName="Edit" Text="Edit"></asp:ImageButton>
                        <asp:ImageButton ID="bttndeleteNote" ImageUrl="~/images/bttnDelete.gif" OnClientClick="if(confirm('Are you sure you want to delete this Application?')==false) return false;" style="cursor:pointer" runat="server" CausesValidation="False" 
                             CommandName="Delete" Text="Delete"></asp:ImageButton>
                     </ItemTemplate>
                     <EditItemTemplate>
                          <asp:ImageButton ID="bttnEditNote" ImageUrl="~/images/bttnSave.gif" style="cursor:pointer" runat="server" CausesValidation="False" 
                             CommandName="Update" Text="Update"></asp:ImageButton>
                         &nbsp; <asp:ImageButton ID="bttnCancelNote" ImageUrl="~/images/bttnCancel.gif" style="cursor:pointer" runat="server" CausesValidation="False" 
                             CommandName="Cancel" Text="Cancel"></asp:ImageButton>
                     </EditItemTemplate>
                 </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                <AlternatingRowStyle BackColor="#DCDCDC" />
            </asp:GridView>
         </td>
    </tr>
 </table>
 </div>
  <table>
<tr>
    <td align="center" colspan="2"><br />
        <asp:ImageButton ID="bttnprint" runat="server" OnClientClick="CallPrint('Printmeonly');" ImageUrl="~/somefolder/images/PrintButton.gif" style="cursor:pointer" />
    </td>
</tr>

<script type="text/javascript">

function CallPrint(strid) {
    var trtitle = document.getElementById('trtitle');
    trtitle.style.display = '';
    var prtContent = document.getElementById(strid);
    var WinPrint = window.open('', '', 'left=0,top=0,width=1,height=1,toolbar=1,scrollbars=1,status=1');
    WinPrint.document.write(prtContent.innerHTML);
    WinPrint.document.close();
    WinPrint.focus();
    WinPrint.print();
    WinPrint.close();
}
</script>

So on print I sent the javascript function a div tag id and print just that. How can I remove that one field just for the print? Any ideas are welcome.

Edited
I edited the markup. the template field consisting of the buttons is the field i want to hide.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:33:56+00:00Added an answer on May 13, 2026 at 1:33 am

    Could you just set display:none on the element you want to remove…in the javascript you’re already using before the print statement?

    Edit to add: if it’s a server-side control you have the ClientID property–but you may end up having some issues with WHEN in the event chain you check the ClientID.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The javascript is printing out the HTML onto the page example below, is it
Like the title says I'm having some trouble printing out symbol codes and their
I have a console app that performs a lengthy process. I am printing out
What I wanted is printing out 5 dots that a dot printed per a
Part of this assignment includes printing out on the display the current equation that
This script below is printing out the checkboxes but isn't plotting anything in the
Got a lovely script that is printing out a bunch of text in raw
this code creates a csv file. However, I have avoided printing out commas in
I'm working on an application that's printing out some text to the user in
I am trying to print out binary number in c however the dilemma i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.