Get response from call using Page.ClientScript
<p>Depending on some values in my application I need to show the confirm box with an OK and a Cancel, if they click OK, it should continue and navigate to another page, otherwise if they click cancel, it should stay in the same page.</p>

<p>The problem I am having is that the pop up does not show UNLESS i add the return statement as follows</p>

<pre><code>  if (true)
        {
         Page.ClientScript.RegisterStartupScript(this.GetType(), 
        "ConfirmBox", "confirm('The numbers selected are not in the directory,"
        + sb.ToString()+
        " you wish to continue?');", true);
                        return;
         }
    Response.Redirect("~/homepage.aspx");
</code></pre>

<p>As you can see this would not work because it would never get to the redirection because of the return, but without the return even if the condition is true it skips the pop up. How can I do this?</p>
