如何我重定向到*打印文档后,另一页*? [英] How to I redirect to another page *after* printing document?

查看:139
本文介绍了如何我重定向到*打印文档后,另一页*?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为事件 SubmitResponse()

用户使用的问题和可能的反应列表psented $ P $。在完成反应后,用户点击preVIEW按钮。如果回答正确,用户点击SubmitResponse按钮,然后 SubmitResponse()处理它。

A user is presented with a list of questions and possible responses. After completing the responses, the user clicks the Preview button. If responses are correct, the user clicks the SubmitResponse button and then SubmitResponse() processes it.

一旦点击SubmitResponse按钮,打印屏幕上弹出,为用户打印一份副本。这是调用code为JS打印功能。

Upon clicking the SubmitResponse button, a print screen pops up for the user to print a copy. This is the calling code for the JS print feature.

finsub.Attributes.Add("OnClick", "print_form()")

工作正常,但有一个问题。我们希望用户被重定向到一个显示他/她与下面的code反应的结果屏幕。

Works fine but there is one problem. We would like the user to be redirected to the screen that displays results of his/her response with the code below.

Response.Redirect("results.aspx")

正在发生的事情是,一旦用户点击按钮submitResponses,他/她会立即重定向到 results.aspx页和打印功能不再可用。

What is happening is that once the user clicks the submitResponses button, s/he is immediately redirected to the results.aspx page and the print feature is no longer available.

有没有办法来解决此问题?

Is there a way to work around this?

推荐答案

您可以做印刷和重定向所有通过JavaScript。下面是应该工作的例子:

You can do the printing and redirect all via javascript. Here is an example that should work:

function doPrint() {
    window.print();            
    document.location.href = "Somewhere.aspx"; 
}

其链接到按钮

<asp:Button ID="btnPrint" runat="server" Text="Print"
    OnClientClick="doPrint(); return false;" />

这篇关于如何我重定向到*打印文档后,另一页*?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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