JavaScript confirm from C# codebehind
<p>I use following code-behind for javascript pop up for conforming, it works well but it does redirect the user to TestPage.aspx always regardless of user selection whether Yes or No.</p>

<pre><code>lblMsg.InnerHtml = @"
    &lt;script type='text/javascript'&gt;
        confirm('Do you want to continue?');
        window.location='TestPage.aspx?ID=" + Request.QueryString["ID"].ToString() + "&amp;txtTest=" + Server.UrlEncode(txtTest.Text) + strSomeString + "'
    &lt;/script&gt;";
</code></pre>

<p>Any idea?</p>

<p>And I use this, this time there is no pop up even.</p>

<pre><code>lblMsg.InnerHtml = @"
    &lt;script type='text/javascript'&gt;
        confirm('Do you want to continue?');
        window.location='TestPage.aspx?ID=" + Request.QueryString["ID"].ToString() + "&amp;txtTest=" + Server.UrlEncode(txtTest.Text) + strSomeString + "'; return false;
    &lt;/script&gt;";
</code></pre>
