Alert message

I need to have pop up message inside an if statement.

If false
    Pop Up (only "ok" button)
end if

Once user clicks ok the code should continue with what its suppose to do next.

this is for asp.net with VB.net code.
pratikshahseAsked:
Who is Participating?
 
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
if false
    string script = "alert ('This is a message');"
    ScriptManager.RegisterStartupScript(me.Page, typeof(Page), "Popup", script, true)
'if typeof page doesn't work do me.Page.GetType()
end if
0
 
CodeCruiserCommented:
You can show a popup on client side but your second requirement to continue code execution after the popup can not be met in ASP.NET. In ASP.NET, code has to complete execution, response has to be sent to the client and then popup can be shown on client side.
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
The register startup script will flag that the popup needs to show, but CC is correct, there's no way to go back and forth between server and client.
0
 
Monica PSoftware DeveloperCommented:
can u make a try like this


if (false)
Response.Write("<script>alert('Condition is False...');</script>")
end if

Open in new window

0
 
ArkCommented:
It's VB#? Use "Then" or remove "end if". You can use 'fake' page with alert only and Response/Server.Redirect conditionally.
if (false) Response.Redirect("dummy.html");
'dummy.html
<script>alert('whatever');document.location.href='realPage.asp?fromDummy=1';</script>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.