Possible duplicate:
ASP.NET MVC: no parameterless constructor defined for this object
I am working on an ASP.NET MVC3 application.
I am trying to use [HttpPost]
to retrieve information when a user enters it into a form.
Based on what I am doing with empty ASP.NET Project scripts by default, I have the following:
In my controller:
public ActionResult Ticket(int id) { Models.Ticket model = new Models.Ticket(id); return View("Ticket", model); } [HttpPost] public ActionResult Ticket(int id, MMCR.Models.Ticket model) { if (id != model.TicketNo) { return View("Error"); } return View("Ticket", model); }
And in the view, I have:
@using (Html.BeginForm()) { <div> <fieldset> <legend>View Ticket Details</legend> <div class="editor-label"> @Html.LabelFor(m=>m.Status) </div> <div class="editor-field"> @Html.DropDownListFor(m=>m.Status, Model.Status) </div> <p> <input type="submit" value="Update" /> </p> </fieldset> </div> }
(obviously dropping repetitive things).
However, when I click on the button, I get an error message:
Exception Details: System.MissingMethodException: A constructor without parameters was not defined for this object.
Can someone give some advice on how to resolve this?
source share