0

My following code works great and shows the confirmation box. I tried a lot but how do I catch the confirmation box message if a user has selected yes or no

Dim script As String = "<script type='text/javascript'> confirm('" + message + "');</script>"
ClientScript.RegisterClientScriptBlock(Me.GetType(), "AlertBox", script)
Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
user580950
  • 3,558
  • 12
  • 49
  • 94
  • What do you mean by "capture the message"? Don't you already have the message as `message` in the code you supplied? You've also mentioned *" I tried a lot"* - could you include some of your attempts? – Tyler Roper Sep 01 '17 at 19:38
  • Please do not put tags in the title. All the cool kids know how to use the tags as a filter which makes it just noise. – Ňɏssa Pøngjǣrdenlarp Sep 01 '17 at 19:38
  • @Santi I would like to pass the javascript variable to the vb.net string so I know if the user clicked on yes or no, so I can apply another condition, depending on the selection. so if confirmation= Yes do This etc – user580950 Sep 01 '17 at 19:40
  • @Plutonix - Thanks that was a mistake – user580950 Sep 01 '17 at 19:41
  • You can't get the result of a javascript confirm in the code-behind without storing it somewhere client-side (like in an ``) and then reading that from the code-behind. You may be better off using a [**`MessageBox`**](https://stackoverflow.com/questions/10777123/c-sharp-messagebox-dialog-result). – Tyler Roper Sep 01 '17 at 19:43

0 Answers0