<%@ Page Title="" Language="C#"MasterPageFile="~/MasterPage/AdminMaster.master" AutoEventWireup="true" CodeFile="DemoReport.aspx.cs" Inherits="Reports_DemoReport" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
function CallPrint(strid) {
var prtContent = document.getElementById(strid);
var strOldOne = prtContent.innerHTML;
var WinPrint = window.open('', '', 'letf=0,top=0,width=600,height=400,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
</script>
<div>
<fieldset>
<legend>Search Date Wise</legend>
<table class="auto-style1">
<tr>
<td>From Date</td>
<td>:</td>
<td>
<asp:TextBox runat="server" ID="txtFromDate" Width="100px"></asp:TextBox>
<asp:ImageButton runat="server" ID="imgFromDate" ImageUrl="~/_images/Calendar.gif" AlternateText="FromDate" />
<asp:CalendarExtender ID="dtpFromDate" runat="server" CssClass=" cal_Theme1" TargetControlID="txtFromDate"
Format="MM/dd/yyyy" PopupButtonID="imgFromDate" PopupPosition="BottomLeft" />
</td>
<td>To Date</td>
<td>:</td>
<td>
<asp:TextBox runat="server" ID="txtToDate" Width="100px"></asp:TextBox>
<asp:ImageButton runat="server" ID="imgTodate" ImageUrl="~/_images/Calendar.gif" AlternateText="ToDate" />
<asp:CalendarExtender ID="CalendarExtender1" runat="server" CssClass=" cal_Theme1" TargetControlID="txtToDate"
Format="MM/dd/yyyy" PopupButtonID="imgTodate" PopupPosition="BottomLeft" />
</td>
<td> <asp:Button ID="btnGO" Text="GO" runat="server" Width="80px" OnClick="btnGO_Click" /></td>
<td><asp:Button ID="btnPrint" runat="server" Text="Print" Width="80px" OnClientClick="CallPrint('printDIV');" /></td>
</tr>
</table>
</fieldset>
</div>
<div id="printDIV">
<fieldset>
<legend>Complain Histroy</legend>
<asp:GridView ID="GridView1" runat="server" Width="1250px" AutoGenerateColumns="False" CellPadding="4" EnableModelValidation="True" ForeColor="Black" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellSpacing="2">
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<RowStyle BackColor="White" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:TemplateField HeaderText="Date" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%#Eval("CurrentDate") %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Superviser" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%#Eval("SUPERVISER") %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="QuarterNo" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%#Eval("QNUMBER") %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="AcknowledgementKey" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%#Eval(" ACKEY") %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="ComplainKey" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%#Eval("COMPKEY") %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%#Eval("STATUS") %>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
</fieldset>
</div>
</asp:Content>
我必须只打印页面上的网格视图,打印工作正常,但我想在打印页面上生成动态页眉/页脚。我怎样才能做到这一点。我通常来自java背景,所以如果你正在编写代码,请让它不那么复杂。感谢您的时间考虑。