How to remove row on click on confirm message true?
<p>I have a asp gridview. On row databound I add onclick event to view item details. I have also delete button. The problem is <strong>When I click item delete, it deletes item but also redirect to item preview page.</strong> It should not do a postback and redirect</p>

<p>here is my code</p>

<pre><code> protected void Grid_DataBound(object sender, GridViewRowEventArgs e)
        {

                e.Row.Attributes["onClick"] = String.Format("location.href='" + "/Url/page.aspx?id=" + "{0}", DataBinder.Eval(e.Row.DataItem, "Id") + "'");
            }
</code></pre>

<p>delete button</p>

<pre><code>public void GvDeleteHabit(object source, CommandEventArgs e)
{
    int id= Convert.ToInt32(e.CommandName);
    Delete(id);
}


&lt;asp:LinkButton OnCommand="Delete" title="Delete" OnClientClick="javascript:return confirm('Do you want to delete?')"
CommandName='&lt;%# Eval("Id")%&gt;' runat="server" ID="BtnDelete"&gt;&lt;/asp:LinkButton&gt;
</code></pre>

<p>on client side I have confirm message. So what I'm trying to achieve is when user click delete button and Yes, I need to remove onclick event from row and delete item.</p>

<p>if user click No stop page from loading. so user can click somewhere on row and view details of item</p>
