我正在使用xslt显示报告并同时打开打印选项。如果用户点击打印,我想更新一些数据。这就是我想跟踪用户是否点击打印或取消的原因。
HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<script type="text/javascript" language="javascript">
window.focus();
window.print();
</script>
<form id="form1" runat="server">
<div>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Label ID="lblError" runat="server" Text="" CssClass="lblError"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Xml ID="xmlPrintDigiRenewal" runat="server"></asp:Xml>
</td>
</tr>
</table>
</div>
</form>
服务器代码:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim objXslTrans As New Xsl.XslTransform
Dim inputXml As New XmlDocument
inputXml.LoadXml(Session("User_Profile").ToString())
objXslTrans.Load(Server.MapPath("../Xslt/RL_DGCertSign.xslt"))
xmlPrintDigiRenewal.Document = inputXml
xmlPrintDigiRenewal.Transform = objXslTrans
Catch ex As Exception
lblError.Text = ex.Message
End Try
End Sub