如何通过gridview图像按钮打印特定记录数据 [英] How to print particular record data through gridview image button

查看:69
本文介绍了如何通过gridview图像按钮打印特定记录数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打印特定的记录表格及其数据而不显示有数据的表格,...

它应该是直接打开的打印弹出窗口(打印预览表格)..



这里是我的代码,用于通过点击网格视图按钮从发送查询字符串重定向到页面: -

  else   if (e.CommandName ==    PrintRecord
{
int index = Convert。 ToInt32(e.CommandArgument);
GridViewRow row = grdOldAdmission.Rows [index];
string studentId = row.Cells [ 5 ]。Text.ToString();
string CenterCode =( string )(会话[ CenterCode]);
Response.Redirect( 〜/ Admission / PrintStudentDetails.aspx?StudentID = + studentId + & CenterCode = + CenterCode + & PageMode = PrintRecord);
}

解决方案

这是asp.net,只有你打印过来的控件就是你的页面数百个客户端。



您可以使用您拥有的页面并在窗口加载时调用javascript打印功能...



这个会导致窗口闪烁片刻并打开用户的打印对话框。

 


window )。load( function (){
window .print();

// 而不是关闭你可以重定向到调用页面
window .close();

});





替代方法是创建准备好打印的PDF或DOC文件,但是没有什么可以强制用户打印...除非可能通过IE上的VBScript(<啊ref =http://stackoverflow.com/questions/9213660/html-javascript-one-click-print-no-dialogs>请看这里 [ ^ ])



相同功能此处 [ ^ ]



Mozzila可以配置为在没有对话框的情况下打印,但您必须能够访问客户端浏览器 - 如果您正在为可以强制使用浏览器并设置每个客户端的公司进行内部应用程序,则可以执行此操作


I want to print particular record form with its data without showing that form which is having data,...
it should be direct open print popup ( print preview form )..

here is my code which i am using to redirect to a page from sending query string on clicking grid view button:--

else if (e.CommandName == "PrintRecord")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = grdOldAdmission.Rows[index];
string studentId = row.Cells[5].Text.ToString();
string CenterCode = (string)(Session["CenterCode"]);
Response.Redirect("~/Admission/PrintStudentDetails.aspx?StudentID=" + studentId + "&CenterCode=" + CenterCode + "&PageMode=PrintRecord");
}

解决方案

This is asp.net, only control you have over printing is by your pages rendred client side.

You can use the page you have and call javascript print function on window load...

This will cause the window to flicker for a moment and open printing dialog for the user.


(window).load(function() { window.print(); // instead of close you can redirect to the calling page window.close(); });



Alternative is to create PDF or DOC file ready for printing, but there is nothing you can do that will force the user to print...except maybe via VBScript on IE (see here[^])

Same function here[^]

Mozzila can be configured to print without dialog, but you have to have access to client browser - if you're doing internal application for the firm in which you can enforce the browser use and setup each client, you can do this.


这篇关于如何通过gridview图像按钮打印特定记录数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆