Redirection not happening when clicking on button
<p>I am trying to redirect the user to a different page upon clicking on a button and stop any asp related events if it meets the validation in the if() statement in javascript, the reason why i am doing it like this is because on a specific page.. it is not grabinhg the On_Click event for some reason. While debugging it.. before it goes into the On_Click event in the .cs file it call multiple classes and functions .. by the time it is done.. it is redirecting somewhere else and never goes through the On_Click event.. now these are a dozen of classes it is going through so I decided to use javascript to do it right after the button is clicked without letting it evaluate in .cs BUT i still want to allow that for other pages because it is working there.. this page seems to be special..</p>

<p>When i click on the image button it is supposed to check the function first and then if its true redirect and stop any other processing on Page_Load or anywhere but its not working see my code here in my user control</p>

<pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="FindPage.ascx.cs"
    Inherits="Data_Manager_FindPage" %&gt;
&lt;script type="text/javascript"&gt;
    function ForwardSearch() {
        if (window.location.href.indexOf('FindPage.aspx') &gt; -1) {
            var value = document.getElementById('&lt;%= txtFind.ClientID %&gt;').value;
            window.location.href = '~/ResultSet.aspx?findvalue=' + encodeURIComponent(value);
        }
    }

&lt;/script&gt; 
</code></pre>
