window.print 然后从代码隐藏 C# 重定向
我已经搜索了所有可能的方法,但我陷入了困境:(希望有人能给我一些关于如何完成以下任务的指示:
Page1 在打印后将 page2 page2 打开
为 windows.print() 我希望它重定向回 page1
现在 page2 在加载完成后在 page_load 上的代码隐藏中加载信息,如果我在加载页面完成后放置一个response.redirect,那么它永远不会打印。希望它可以理解,以便有人可以给我某种解决方案。
我尝试设置一个计时器,但问题是用户可能无法立即打印,或者他们必须等待计算机识别打印机或任何其他情况,所以我必须依赖它打印,然后重定向
。重定向必须从代码隐藏传递一个变量,所以我想可能是从代码隐藏调用 windows.print 并传递该参数,以便在完成后它可以使用正确的值从 javascript 重定向
?
I have searched every possible way and I'm stuck :( hopefully somebody can give me some pointers on how to accomplish the following:
Page1 opens page2
page2 as windows.print() after it prints i would like for it to redirect back to page1
now page2 loads information in codebehind on page_load after its done loading the it prints if I put a response.redirect after its done loading the page then it never prints. Hope its understandable so that someone can give me some sort of solution.
I've tried to put a timer but the problem is that the user might not print right away or they have to wait for the computer to recognize the printer or any other situation so I have to rely on it printing and then redirecting.
Also the redirect must pass a variable from codebehind so what I'm thinking is maybe calling the windows.print from codebehind and passing that parameter so after its done it can redirect from javascript with the correct value? Any help is much appreciated.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个可能的解决方案是使用
window.open();
在新窗口中打开page2
然后用户打印并关闭窗口。简单、干净、有效。A possible solution is just to open
page2
in a new window withwindow.open();
Then the user prints, and closes the window. Simple, clean, effective.