Allow mesage box to popup on redirect of page

I have made a popup that works within an update panel but what I can't get to work is that it calls the response.redirect to the home page right away instead of giving me the popup box.  Is there a way to get around this.  I insert my sql to the db, then call the popup but and then want to redirect to home page.  but it automatically goes to home page is there a way to stop it until message is seen then redirect.



insertUpdateDelete(sql)

        ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "message();", True)

        Response.Redirect("~/Home.aspx")

kdeutschAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
Use your original code but redirect using the JavaScript rather than code behind because the code behind would not wait for popup.
0
 
starlite551Commented:
Yes use this code :
string message ="Success";
Response.Write(
"<script language='javascript'>alert('"+message+"');</script>");

Open in new window

0
 
starlite551Commented:
Sorry I forgot this is VB.NET Section heres your code :
Dim message As String = "Success"
Response.Write("<script language='javascript'>alert('" & message & "');</script>")

Open in new window

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
starlite551Connect With a Mentor Commented:
call this code before calling Response.Redirect("~/Home.aspx")
0
 
kdeutschAuthor Commented:
Do I need to make a javascript message in my html, currently I have the meesge in a javascript file, and will this work with an updatepanel.
0
 
kdeutschAuthor Commented:
Ok, see what you how it is, does not work.  

 insertUpdateDelete(sql)

        Dim message As String = "Success"
        Response.Write("<script language='javascript'>alert('" & message & "');</script>")

        'ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "message();", True)

        Response.Redirect("~/Home.aspx")
0
 
kdeutschConnect With a Mentor Author Commented:
ok, got it, here is the final solution.

ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "OnClick", "alert('Your SRP Event has been saved. It is only valid from beginning date for 3 days!');window.location.href='../Home.aspx';", True
0
 
kdeutschAuthor Commented:
thanks
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.