I'm developing a web app with ASP.NET MVC 2 (.NET 4.0), and I've run into a difficult problem.
I've got the following code in a partial view:
<% using (Ajax.BeginForm("CompleteTask", "Agenda", new AjaxOptions {HttpMethod = "POST"})) { %>
<%: Html.EditorFor(x => x.Remarks) %>
<%: Html.HiddenFor(x => x.TaskId) %>
<%: Html.HiddenFor(x => x.AgendaId) %>
<% if (Model.RequiresApproval) { %>
<input type="image" name="Result" value="0" src="../../Content/Icons/thumbs_up.png" />
<input type="image" name="Result" value="1" src="../../Content/Icons/thumbs_down.png" />
<% } else { %>
<input type="image" name="Result" value="0" src="../../Content/Icons/accept.png" />
<% } %>
<% } %>
The following parameters are posted:
- AgendaId - 1046
- Remarks - sample remarks
- Result.x - 8
- Result.y - 8
- TaskId - 0
- X-Requested-With - XMLHttpRequest
I was expecting the following:
- AgendaId - 1046
- Remarks - sample remarks
- Result - 0 or 1
- TaskId - 0
- X-Requested-With - XMLHttpRequest
The code seemed to work fine with Html.BeginForm(), but that won't suffice as I need to handle JSON results.
Can someone shed some light on what's going wrong? Thanks!
NOTE: I should also note that switching to a "submit" type attribute (from the "image" type attribute) seems to work as well, but I need to use an image submit. I'm thinking this might be a bug in the ASP.NET MVC JavaScript code...