In my controller, I have an action method that receives a response (200 OK) from a view, but it never runs. The view has a Url.Action that sends a request to the action method, but the method is never called. Triggering the action results in a blank page.
View:
@model Project.Web.ViewModels.SomeModel
<div class="modal fade" id="@("RemoveThingModal" + Model.Id")" tabindex="-1" role="Dialog" aria-labelledby="@(RemoveThingModal" + Model.Id)">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form id="@("DeleteForm" + Model.Id)" action="@Url.Action("RemoveThing", "Foo")" method="post">
@Html.HiddenFor(m => m.Id)
@Html.HiddenFor(m => m.SomeNameString)
<div class="modal-header">
<button type="button" class="Close" data-dismiss="modal" aria-label="Close"><span aria-hidden="True">×</span></button>
<h4 class="modal-title" id="@("RemoveThingModal" + Model.Id)">@MainResource.DeleteModalTitle</h4>
</div>
<div class="modal-body col-md-12">
<div>
@MainResource.DeleteModalMessage
<h3>@string.Format("{0}: {1}", @MainResource.DataTableColumnThingName, Model.Name)</h3>
</div>
</div>
<div class="modal-footer col-md-12">
<button type="button" class="btn btn-default" data-dismiss="modal">@MainResource.CancelLink</button>
<button type="submit" id="#@("deleteSubmitButton" + Model.Id)" class="btn btn-danger">@MainResource.RemoveButton</button>
</div>
</form>
</div>
</div>
</div>
Controller (FooController):
[HttpPost]
public ActionResult RemoveThing(int barId)
{
System.Diagnostics.Debug.WriteLine("DEBUG: aaaa");
try {
return RedirectToAction("List");
}
catch (Exception e)
{
throw new Exception(e.Message);
}
}
Not even the debug print statement is called. At some point, it worked, but the changes were not committed and the undo history was lost.
- Changing the view's Url.Action to another action in a different controller works.
- Other actions in the controller work when called from other views.