ASP.NET- Prompt confirmation only if needed
<p>I have a button. And I have a Session["actionMode"]. Here what I do in my buttonClick event:</p>

<pre><code>protected void Button1_Click(object sender, EventArgs e)
{

    if ((int)Session["actionMode"]==1)
    {
      //Do something
    }
    else if ((int)Session["actionMode"]==3)
    {
       //After confirmation delete a record
    }

}
</code></pre>

<p>As you can see if value of Session["actionMode"] equals 3  a record is deleted. But before deletion I want to prompt the user to confirm the action. So if value of Session["actionMode"] does not equal 3 I don't need any confirmation because it does not do anything that can't be undone. Is there a way I can achieve this? Javascript maybe?</p>
