title: How to cancel _doPostBack
body: <p>i have a problem that i cannot solve. i just want to click one button then trigger C# code to write entered string to sql and open other aspx web site. however after writing string to sql, page is being refreshed codes are below</p>
  <pre><code>                &lt;div class=&quot;modal-footer&quot;&gt;
                      &lt;button type=&quot;button&quot; class=&quot;btn btn-secondary&quot; data-bs-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;
                      &lt;a href=&quot;A3_Maturity.aspx&quot; id=&quot;StarttoEvaluate&quot; runat=&quot;server&quot; class=&quot;btn btn-primary&quot;  onserverclick=&quot;StarttoEvaluate_Click&quot; &gt;Enter&lt;/a&gt;
                  &lt;/div&gt;
  </code></pre>
  <p>C#</p>
  <pre><code>    protected void StarttoEvaluate_Click(object sender, EventArgs e)
      {
  
  
          
      protected void StarttoEvaluate_Click(object sender, EventArgs e)
      {
  
  
          
          SqlCommand comd = new SqlCommand(&quot;insert into A3_Coaching (name) values (@p1)&quot;, con.connection());
          comd.Parameters.AddWithValue(&quot;@p1&quot;, A3name.Value.ToString());
          comd.ExecuteNonQuery();
          con.connection().Close();
  
  
      }
  </code></pre>