[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

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.
0
pratikshahse
Asked:
pratikshahse
1 Solution
 
Kyle AbrahamsSenior .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 PCommented:
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now