locked
Need to show message and redirect RRS feed

  • Question

  • User-909867351 posted

    Hi 

    I need to show one message and after that I need to redirect to another page. I use pnotify as follows:

    if (Session["edificio"] == null)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop5", "showMessage('123 Condomínios','Deve escolher condomínio!','error','1000');", true);
                Response.Redirect("novobanco.aspx?bancos=2");      
                return;
            }

    and the script jquery

    <script src="pnotify/pnotify.custom.min.js" ></script>
        <link rel="stylesheet" type="text/css" href="pnotify/pnotify.custom.min.css" />
           <script>      
               function showMessage(title, msg, informa, tempo) {
                   debugger;
                   new PNotify({
                       title: title,
                       text: msg,
                       type: informa,
                       delay: tempo,
    
                   });
               }
    </script>    

    The problem is the message not show because the response.redirect

    How can I solve this issue?

    Thank you

    mario

    Friday, November 22, 2019 4:41 PM

Answers

  • User409696431 posted

    Pass a parameter to the next page when you redirect, then in that page, if the parameter indicates it should, display a message explaining why the user is now on that page.

    Alternatively, you could try adding the move to the new page to the javascript that displays the message.

    Stick with either server-side or client-side for both actions.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 23, 2019 5:35 AM
  • User-1780421697 posted
    From your server side mthod you just need to display confirm dialog or what you want and on click of yes or no you need to redirect user by window.location=destination.aspx?anyparameter=anyvalue
    That is easy solution to implement
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 23, 2019 7:11 AM

All replies

  • User409696431 posted

    Pass a parameter to the next page when you redirect, then in that page, if the parameter indicates it should, display a message explaining why the user is now on that page.

    Alternatively, you could try adding the move to the new page to the javascript that displays the message.

    Stick with either server-side or client-side for both actions.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 23, 2019 5:35 AM
  • User-1780421697 posted
    From your server side mthod you just need to display confirm dialog or what you want and on click of yes or no you need to redirect user by window.location=destination.aspx?anyparameter=anyvalue
    That is easy solution to implement
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, November 23, 2019 7:11 AM