title: disable OnClientClick when LinkButton is disabled
body: <p>In my gridview, I have included a column containing a <code>LinkButton</code> that allows you to delete the record on the same row where the <code>LinkButton</code> is :</p>
  
  <pre><code>&lt;asp:TemplateField HeaderText=""&gt;
       &lt;ItemTemplate&gt;
            &lt;asp:LinkButton ID="lnkDeleteTxn" Text="Delete" runat="server" CommandArgument='&lt;%# Eval("TxnID") %&gt;' OnClick="deleteTxn" 
            OnClientClick="return confirm('!!--WARNING--!! You are about to delete the transaction. Performing this action will permanently remove the transaction and all its details from the database. Proceed?');"&gt;&lt;/asp:LinkButton&gt;
       &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>This <code>LinkButton</code> includes showing a pop-up window asking if the user really wants to delete the record. Now, for my <code>RowDataBound</code> event, I set it so that whenever the Status of the Record is "Approved", the Delete LinkButton is disabled:</p>
  
  <pre><code>string recStatus = Convert.ToString(DataBinder.Eval(e.Row.DataItem,"StatusDesc"));
  if (recStatus == "Approved")
  {
      hlTxnEdit.Enabled = false;
      lnkTxnDelete.Enabled = false;
  }
  else
  {
      hlTxnEdit.Enabled = true;
      lnkTxnDelete.Enabled = true;
      //lnkTxnDelete.Attributes.Add("OnClientClick", "return confirm('!!--WARNING--!! You are about to delete the transaction. Performing this action will permanently remove the transaction and all its details from the database. Proceed?')");
  }
  </code></pre>
  
  <p>the problem is, when the user clicks on the disabled LinkButton, the confirmation pop-up still displays, when it should not, because the LinkButton is disabled. Makes a bit of sense, because the Attribute where the pop-up window is set is on the <code>OnClientClick</code> attribute. How do I make the pop-up window not show up? I tried adding the <code>OnClientClick</code> attribute in the code behind, but it doesn't work. The LinkButton proceeds straight on deleting the record.</p>