AGENDA:
Print the data in GridView for one page.
Step-1:
First Copy and paste the below in aspx page (design page).
<script language="javascript" type="text/javascript">
function
PrintGridData() {
var
prtGrid = document.getElementById('<%=GridViewID.ClientID
%>');
prtGrid.border = 1;
var
prtwin = window.open('', 'PrintGridViewData', 'left=100,top=100,width=1000,height=1000,tollbar=10,scrollbars=1,status=0,paresizable=1');
prtwin.document.write(prtGrid.outerHTML);
prtwin.document.close();
prtwin.focus();
prtwin.print();
prtwin.close();
}
Step-2:
Design will be like this
<table>
<tr>
<td>
<asp:Button ID="btnPrintCurrentPage" runat="server"
Text="Print
Current Page" OnClientClick="PrintGridData();" /><vr />
</td>
</tr>
</table>
Note:
(1.) Don’t write any OnClick Events
(2.) In JavaScript Paste your gridview ID in
place of ('<%=GridViewID.ClientID
%>')
No comments:
Post a Comment