In my MVC application I have a grid that uses a HTML helper function. The EditorTemplate looks like;
<tr>
<td>
<%-- Ajax Delete --%>
<% if(Model.LeaveId > 0) { %>
<%: Html.DeleteEmployeeOtherLeave("Delete", Model)%>
<%} %>
</td>
<td><%: Model.LeaveType %></td>
<td><%: Model.MorningOnlyFlag %></td>
<td><%: Model.AfternoonOnlyFlag %></td>
<td><%: Model.DayAmount %></td>
<td><%: String.Format("{0:ddd MMM d yyyy}", Model.Date)%></td>
</tr>
And the HTML helper looks like;
public static MvcHtmlString DeleteEmployeeOtherLeave(this HtmlHelper html, string linkText, Leave _leave)
{
return html.RouteLink(linkText, "Default",
new { _employeeOtherLeaveId = _leave.LeaveId, action = "Delete" },
new { onclick = "$.ajax({url: this.href, type: 'DELETE', success: function(result) {$('#wholepage').html(result);}}); return false;" }
}
My controller looks like;
[HttpGet]
[Authorize(Roles = "Administrator, AdminAccounts, ManagerAccounts")]
public ActionResult EmployeeAbsence()
{
if ((SessionObjects.AbsenceStartDate > DateTime.MinValue) && (SessionObjects.AbsenceEndDate > DateTime.MinValue))
if (SessionObjects.AbsenceSelectedEmployeeId == 0)
return View(new AbsenceViewModel()
{
AbsenceStartDate = SessionObjects.AbsenceStartDate,
AbsenceEndDate = SessionObjects.AbsenceEndDate
});
else
return View(new AbsenceViewModel(
SessionObjects.AbsenceStartDate,
SessionObjects.AbsenceEndDate,
SessionObjects.AbsenceSelectedEmployeeId
));
return View();
}
[AcceptVerbs(HttpVerbs.Delete)]
public ActionResult Delete(int _employeeOtherLeaveId)
{
EmployeeOtherLeaf.Delete(_employeeOtherLeaveId);
return RedirectToAction("EmployeeAbsence");
}
#endregion
Using the Delete verb works in FF, but not in IE. Replacing the DELETE verb with POST seems to prevent it from working at all. How do I get this to work in IE?