I have a strongly typed views where I pass editors for several properties eg.
public class BookingModel
{
public FirstPropertyModel FirstProperty { get; set; }
public SecondPropertyModel SecondProperty { get; set; }
public ThirdPropertyModel ThirdProperty { get; set; }
}
@model MyWebsite.Models.BookingModel
@using (Html.BeginForm("Order", "Booking", FormMethod.Post, new { @id = "order_summary" }))
{
@Html.EditorFor(model => model.FirstProperty, "_FirstProperty")
@Html.EditorFor(model => model.SecondProperty, "_SecondProperty")
@Html.EditorFor(model => model.ThirdProperty, "_ThirdProperty")
<input type="submit" id="btnOrder" value="Order" />
}
All properties objects are passed to the action nicely but one property (First) which comes as null.
They all are within EditorTemplates and their views are also strongly types - use their own models.
ANy idea why is this happening?
I'd try initializing/instantiating the BookingModel properties in the constructor to see if that helps