如何在打印时从Gridview中隐藏列 [英] How to hide the Column from Gridview while Printing
问题描述
你好朋友,祝你有个美好的一天!
正在使用asp.net Gridview我想打印Gridview数据,它的工作正常。
我在gridview的左侧有一个选择按钮,我的意思是GridView1_SelectedIndexChanged(对象发送者,EventArgs e)通过这个我可以选择另一个页面中的特定行。它很好但是事情是.....
< 列 >
< asp:CommandField ShowSelectButton = True / >
< / Columns >
打印Gridviewcommand字段按钮(选择)时也打印。
那么如何隐藏选择按钮
这是我的javascript打印工作正常。
< span class =code-keyword>< script type = text / javascript >
函数PrintGridData(){
var prtGrid = document.getElementById('<% = GridView1。 ClientID %> ');
prtGrid.border = 0;
var prtwin = window.open('','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' > 用户信息< / span > < br / > < br / > < span style =' 颜色:#00671A; font-family:Arial,Helvetica,sans-serif; font-weight:bold; font-size:22px; align; text-align:center' > 当前记录< / span > < br / > < br / > < / div > 跨度>);
prtwin.document.write(prtGrid.outerHTML);
prtwin.document.close();
prtwin.focus();
prtwin.print();
prtwin.close();
}
< / script >
< input type =buttonid =btnPrintvalue =Printonclick =PrintGridData()/>
那么,如何在打印时隐藏Gridview中的选择按钮..请帮助谢谢.....
在GridView中使按钮Visible = false aspx页面。所以现在打印网格时不会显示按钮。
加载网格后,代码中的按钮可见= true。
试一试!
快速提交答案
; dgldg
Hello Friends, have a good day !!
am working on asp.net 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 .....
<Columns>
<asp:CommandField ShowSelectButton="True" />
</Columns>
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 = window.open('', '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>");
prtwin.document.write(prtGrid.outerHTML);
prtwin.document.close();
prtwin.focus();
prtwin.print();
prtwin.close();
}
</script>
<input type="button" id="btnPrint" value="Print" onclick="PrintGridData()" />
So, how to hide select button from Gridview while printing..Please help Thanks.....
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!
Submit Answers Fast
;dgldg
这篇关于如何在打印时从Gridview中隐藏列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!