Solved

Allow mesage box to popup on redirect of page

Posted on 2011-02-12
8
561 Views
Last Modified: 2012-05-11
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")

0
Comment
Question by:kdeutsch
  • 4
  • 3
8 Comments
 
LVL 12

Expert Comment

by:starlite551
ID: 34879470
Yes use this code :
string message ="Success";
Response.Write(
"<script language='javascript'>alert('"+message+"');</script>");

Open in new window

0
 
LVL 12

Expert Comment

by:starlite551
ID: 34879475
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
 
LVL 12

Assisted Solution

by:starlite551
starlite551 earned 150 total points
ID: 34879481
call this code before calling Response.Redirect("~/Home.aspx")
0
 

Author Comment

by:kdeutsch
ID: 34879625
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:kdeutsch
ID: 34879629
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
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 200 total points
ID: 34879812
Use your original code but redirect using the JavaScript rather than code behind because the code behind would not wait for popup.
0
 

Assisted Solution

by:kdeutsch
kdeutsch earned 0 total points
ID: 34879848
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
 

Author Closing Comment

by:kdeutsch
ID: 34914355
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now