Click here to Skip to main content
13,449,326 members (46,319 online)
Rate this:
Please Sign up or sign in to vote.
Hello Friends, have a good day !!

am working on Gridview i want to print the Gridview data its working fine.
I have a select button at the left side of gridview, I mean GridView1_SelectedIndexChanged(object sender, EventArgs e)through this i can select particular row in another page. its fine But the thing is .....

<asp:CommandField ShowSelectButton="True" />

While printing Gridviewcommand Field button(Select) is also printing.

So how to hide that Select button

This is my javascript for printing its working fine.

<script type="text/javascript">
function PrintGridData() {
var prtGrid = document.getElementById('<%=GridView1.ClientID %>');
prtGrid.border = 0;
var prtwin ='', 'PrintGridViewData', 'left=100,top=100,width=1000,height=1000,tollbar=0,scrollbars=1,status=0,resizable=1');
var logoData="";
prtwin.document.write("<div align='center'><span style='color:#00671A;font-family:Arial, Helvetica, sans-serif;font-weight:bold;font-size:22px;align;text-align:center'>Users Information </span><br/><br/><span style='color:#00671A;font-family:Arial, Helvetica, sans-serif;font-weight:bold;font-size:22px;align;text-align:center'>Current Records </span><br/><br/></div>");


<input type="button" id="btnPrint" value="Print" onclick="PrintGridData()" />

So, how to hide select button from Gridview while printing..Please help Thanks.....
Posted 18-Jan-13 19:37pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Make the button Visible = false inside the GridView in aspx page. So now while printing the grid won't show up the button.

Make the button visible = true in the code behind while loading the grid.

Try it out!
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Submit Answers Fast


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180318.3 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100