Solved

Allow mesage box to popup on redirect of page

Posted on 2011-02-12
8
565 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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
 

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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