Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
urpalshu
Starting Member
21 Posts |
Posted - 2006-10-19 : 10:21:03
|
I am working on an ASP.NET application.<script type="text/javascript" language="javascript">var Message = "If you press cancel ... you will be thrown back into the page you came from." if (! confirm (Message)) { window.history.back (); } </script>------------------------------------------------------------------------------------------------------C# codeprivate void printPackingLabel() { printContainerLabel(Convert.ToInt32(qtyToPrint.Text.Trim()));while(true){ string focus = "<script language='javascript'>confirm('Packing label printed. Do you wish to reprint the packing label?');</script>";Page.RegisterStartupScript("Focus", focus); if( If the user clicks OK I want to be able to reprint) { printContainerLabel(Convert.ToInt32(qtyToPrint.Text.Trim())); continue; } break;}------------------------------------------------------------------------------------------------------This code above pops up a MessageBox.1. If the user clicks on cancel , does nothing. This part is working good the History Page is Back.2. If the user clicks OK I want to be able to do a reprint like the logic I have mentioned above.3. Until the user says cancel, he has an option to go on with reprint4. I do not have any Button_Click Event triggered in this situationPlease could somebody help me with the syntax, |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-10-19 : 16:57:36
|
You're mixing client-side and server-side code. When a user clicks a button in a browser dialog (which is what the Confirm dialog is) you cannot detect that in your server-side C# code. The best you can do is have the client-side Javascript post back to the server when the user clicks the button, you can do that by calling the form submit() method in your Javascript, something like thisstring focus = "<script language='javascript'>var conf = confirm('Packing label printed. Do you wish to reprint the packing label?'); if (conf) document.forms[0].submit();</script>"; |
 |
|
|
|
|