打印页面上的gridvew中心 [英] gridvew center on the print page
本文介绍了打印页面上的gridvew中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个gridview,我想当我点击打印按钮然后所有数据显示在中心页面和gridview上部的标题显示。
Hi
I have a gridview and i want when i am click on the print button then all the data show in the center of page and a header show of the upper of gridview.
推荐答案
我认为用javascript更容易做到这一点。
i think than it is easier to do it with javascript.
<script type="text/javascript" language="javascript">
function CallPrint(strid) {
var prtContent = document.getElementById(strid);
var WinPrint = window.open('', '', 'letf=0,top=0,width=860,height=800,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
</script>
然后
And then
<input type="image" runat ="server" id ="Image1" src ="/images/images.jpg" onclick="javascript: CallPrint('divPivot1')" title="Print" />
<br />
<div id= "divPivot1">
<asp:GridView ID="OrderGridView" runat="server" AllowPaging="True"
BorderStyle="None" CellPadding="3" DataKeyNames="Article"
Font-Size="Small" HorizontalAlign="Left"
OnPageIndexChanging="OrderGridView_PageIndexChanging" PageSize="20"
TabIndex="15" Width="866px" BackColor="White" BorderColor="#CCCCCC"
BorderWidth="1px">
<FooterStyle BackColor="White" ForeColor="#336699" />
<HeaderStyle BackColor="#336699" Font-Bold="True" ForeColor="White" />
<PagerSettings FirstPageText="First" LastPageText="Last" />
<PagerStyle BackColor="White" ForeColor="#336699" HorizontalAlign="Left" />
<RowStyle ForeColor="#336699" Font-Size="Small" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
<Columns>
<asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Update Cartons Quant." ItemStyle-HorizontalAlign="Center" ItemStyle-Width="40">
<ItemTemplate>
<asp:TextBox ID="TextBox" runat="server" Width="90" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br /></div>
DIV内的所有内容都将被打印
everything inside DIV will be printed
这篇关于打印页面上的gridvew中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文