asp.Net prevent server side link with javascript
<p>I have an ImageButton as follows</p>

<pre><code>&lt;asp:ImageButton OnClientClick="javascript:merge();" ID="MenuLinkMerge" Text="Merge" ToolTip="Merge" SkinID="Merge32" runat="server" onclick="MenuLinkMerge_Click" /&gt;
</code></pre>

<p>merge() will call</p>

<pre><code>function merge() {
    if (IDList.length &gt; 0) {
        alert("go");
        return true;
    } else {
        alert("No companies were selected.");
        return false;
    }
}
</code></pre>

<p>but whether I return true or false the MenuLinkMerge_Click is always called server side and the page is redirected. I only want the page to change if IDList.length > 0 otherwise display the alert and do nothing.</p>

<p>How do I accomplish this?</p>
