title: MVC3. Ajax Confirmation comes twice
body: <p>I have a list of Products. Each line has 'Delete' action. When I try to delete any row everything is true, but after second deleting ajax confirmation comes twice. Please help.</p>
  
  <p>There are product list view.</p>
  
  <pre><code>@model IEnumerable&lt;Domain.Entities.Product&gt;
  @{
  ViewBag.Title = "Products";
  Layout = "~/Views/Shared/_AdminLayout.cshtml";
  }
  &lt;h1&gt;Products&lt;/h1&gt;
  &lt;table class="Grid"&gt;
  &lt;tr&gt;
      &lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
  &lt;/tr&gt;
  @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;@item.Name&lt;/td&gt;
          &lt;td&gt;@item.Description&lt;/td&gt;
          &lt;td&gt;@item.Price&lt;/td&gt;
          &lt;td&gt;
              @using (Ajax.BeginForm("DeleteProduct", "Admin", 
                      new AjaxOptions { 
                                        Confirm="Product was deleted!", 
                                        UpdateTargetId="DeleteProduct"
                                      }))
              {
                  @Html.Hidden("Id", item.Id)
                  &lt;input type="image" src="../Images/Icons/DeleteIcon.jpg" /&gt;
              }
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  &lt;/table&gt;
  </code></pre>
  
  <p>There are AdminController</p>
  
  <pre><code>[Authorize]
  public class AdminController : Controller
  {
      private IProductRepository productRepository;
  
      public AdminController(IProductRepository productRepository)
      {
          this.productRepository= productRepository;
      }
  
      public ViewResult Products()
      {
          return View(productRepository.Products);
      }
  
      [HttpPost]
      public ActionResult DeleteProduct(int id)
      {
          Product prod = productRepository.Products.FirstOrDefault(p =&gt; p.Id == id);
          if (prod != null)
          {
              productRepository.DeleteProduct(prod);
              TempData["message"] = string.Format("{0} was deleted", prod.Name);
          }
          return RedirectToAction("Products");
      }
  }
  </code></pre>
  
  <p>And finally _AdminLayout.cshtml</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;@ViewBag.Title&lt;/title&gt;
  &lt;link href="@Url.Content("~/Content/Admin.css")" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="DeleteProduct"&gt;
      @if (TempData["message"] != null) {
          &lt;div class="Message"&gt;@TempData["message"]&lt;/div&gt;
      }
      @RenderBody()
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>