Whenever I submit the form the model passed into the controller is NULL. I\'ve spent ages looking at this. I think I am missing something fundamental here.
@
You need to pass ReinviteVisitorModel
model in your Action
Update you action with this:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreateMeeting(ReinviteVisitorModel model)
{
return RedirectToAction("ReinviteVisitor2", "Home", new { visitorId = model.NewMeeting.SubjectId });
}
The model in your view is typeof ReinviteVisitorModel
which means the signature of the POST method must match since your posting ReinviteVisitorModel
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreateMeeting(ReinviteVisitorModel model)
alternatively you can use the Prefix
property of BindAttribute
to strip the NewMeeting
prefix from the names of the form controls your are posting.
public ActionResult CreateMeeting([Bind(Prefix="NewMeeting")]Meeting model)
Side note: Remove new { @Value = Model.Info.SubjectId }
from the hidden input and instead set the value of NewMeeting.SubjectId
in the GET method before you pass the model to the view.