I have an event called SubmitResponse()
.
A user is presented with a list of questions and possible responses. After completing the responses, the user
For cross browser compatibility, you need to introduce a delay between the window.print() call and the redirect.
I find the following works well (using JQuery framework to print a page as soon as it loaded):
<script type="text/javascript">
$(document).ready(function () {
window.print();
setTimeout("closePrintView()", 3000);
});
function closePrintView() {
document.location.href = 'somewhere.html';
}
</script>
This can be easily adapted for "Print" buttons and links etc.
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";
}
Link it to a Button
:
<asp:Button ID="btnPrint" runat="server" Text="Print"
OnClientClick="doPrint(); return false;" />
Redirect on client side using javascript/jQuery
onclick="window.print();window.location.href='results.aspx';"
For your case
insub.Attributes.Add("OnClick", "print_form();window.location.href='results.aspx';")
you can use this code :
window.print();
window.onafterprint = function(event) {
window.location.href = 'index.php'
};
using window.print() callBack!!
<script type="text/javascript">window.location = 'url.aspx';</script>