, если вы хотите, чтобы с помощью 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();
}
Хмель его помогает
могу ли я сделать это с помощью C# ...... –
вы должны попробовать это link..http: //www.dotnetcurry.com/Sho wArticle.aspx? ID = 92 или также см. этот [вопрос]: http: //stackoverflow.com/questions/9561744/asp-net-print-function-to-print-asp-net-controls-with-its-style/9562504 # 9562504 может помочь u !!! – Jigs