私はデータベースからグリッドビューを持っていますが、問題は、ユーザーが印刷ボタンをクリックしたときにページ全体を印刷したいということです。グリッドビューの各行は、1つのA4サイズのページに3行として指定された形式で印刷されます。
グリッドビュー
印刷フォーマット
私はデータベースからグリッドビューを持っていますが、問題は、ユーザーが印刷ボタンをクリックしたときにページ全体を印刷したいということです。グリッドビューの各行は、1つのA4サイズのページに3行として指定された形式で印刷されます。
グリッドビュー
印刷フォーマット
JavaScriptを使用したい場合は、これを試すことができます
function printItn() {
//In my case i have append gridview in Panel that y..you can put your contentID which is you want to print.
var printContent = document.getElementById('<%= pnlForm.ClientID %>');
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
// you should add all css refrence for your Gridview. something like.
var WinPrint= window.open(windowUrl,windowName,'left=300,top=300,right=500,bottom=500,width=1000,height=500');WinPrint.document.write('<'+'html'+'><head><link href="cssreference" rel="stylesheet" type="text/css" /><link href="gridviewcssrefrence" rel="stylesheet" type="text/css" /></head><'+'body style="background:none !important"'+'>');
WinPrint.document.write(printContent.innerHTML);
WinPrint.document.write('<'+'/body'+'><'+'/html'+'>');
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
ホップが役立ちます
I will suggest you to use some reporting framework such as SSRS/Report-Viewer, Crystal Reports for generating such output.
For example, you can create the report definition in RDLC file having a group on some ranking function (to ensure three rows) and display it using ReportViewer control - have a look at this site for more information about reportviewer: http://gotreportviewer.com/