title: postback fires even after returning false from OnClientClick
body: <p>I need to Stop Button1_Click fire after Jquery function return false..This is my Code ... </p>
  
  <pre><code>&lt;%@ Page Language="C#" %&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head id="Head1" runat="server"&gt;
      &lt;script type="text/javascript" src="http://code.jquery.com/Javascript/jquery-1.4.2.min.js"&gt;&lt;/script&gt;
      &lt;script src="Scripts/a.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script runat="server"&gt;
  
          protected void Button1_Click(object sender, EventArgs e)
          {
  
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
          &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
          &lt;asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return x();"  OnClick="Button1_Click" /&gt;
              OnClick="Button1_Click" /&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>js File </p>
  
  <pre><code>function x() {
  
      alert('');
  
      return false;
  }
  </code></pre>
  
  <p>this is my HTML generated File </p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head id="Head1"&gt;
      &lt;script type="text/javascript" src="http://code.jquery.com/Javascript/jquery-1.4.2.min.js"&gt;&lt;/script&gt;
      &lt;script src="Scripts/a.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;title&gt;
  
  &lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
      &lt;form method="post" action="Default.aspx" id="form1"&gt;
  &lt;div class="aspNetHidden"&gt;
  &lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTExNTM0OTE4ODNkZI8CSkltDp/afauc6DGl2D8JvNnVI1ffgzykF0L2alVM" /&gt;
  &lt;/div&gt;
  
  &lt;div class="aspNetHidden"&gt;
  
      &lt;input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAAOSROoMi8eHXeBzZ77oKwMrESCFkFW/RuhzY1oLb/NUVM34O/GfAV4V4n0wgFZHr3eJjGQabRwzK4TIMzE2tX2gN9468Yg/u6i/oj/9EvNo1w==" /&gt;
  &lt;/div&gt;
      &lt;div&gt;
          &lt;input name="TextBox1" type="text" id="TextBox1" /&gt;
          &lt;input type="submit" name="Button1" value="Button" onclick="return x();" id="Button1" /&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I also tried Similar links :</p>
  
  <p><a href="https://stackoverflow.com/questions/6812168/why-doesnt-returning-false-from-onclientclick-cancel-the-postback">Why doesn&#39;t returning false from OnClientClick cancel the postback</a></p>
  
  <p>In this case a handler for the one more  click event was registered via jquery ..I think it is not in my case </p>
  
  <p><a href="https://stackoverflow.com/questions/3893963/asp-net-onclientclick-return-false-doesnt-work?lq=1">ASP.NET OnClientClick=&quot;return false;&quot; doesn&#39;t work</a></p>
  
  <p>there should not be a click event handler (registered via jquery) which returns true .whats mean by that ?Does it mean that i need to remove onClick function ... i dont wanna do it </p>
  
  <p>I also tried other suggested Code :</p>
  
  <pre><code>&lt;asp:Button ID="Button1" runat="server" Text="Button"  OnClientClick="if (!x()) return     
  false;"  OnClick="Button1_Click" /&gt; 
  
  &lt;asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:return        
  x();"OnClick="Button1_Click" /&gt;  
  </code></pre>
  
  <p>they are also not working </p>
  
  <p>Plese suggest</p>