I have a search object:
public class Search
    {
    [Display(Name = "First name:")]
    [DataType(DataType.Text)]
    public string fname { get; set; }
    [Display(Name = "Surname:")]
    [DataType(DataType.Text)]
    public string sname { get; set; }
    [Display(Name = "Date to (dob):")]
    [DataType(DataType.Date)]
    public DateTime? dateT { get; set; }
    [Display(Name = "Date from (dob):")]
    [DataType(DataType.Date)]
    public DateTime? dateF { get; set; }
    public Search()
    {
        /*
        first_name = string.Empty;
        surname = string.Empty;
        dateT = null;
        dateF = null;
        */            
    }
}
I've instantiated this in the following class:
public class MainModel
{
    public UserML userLM;
    public Search search;
    public MainModel()
    {
        userLM = new UserML();
        search = new Search();           
    }
}
The Main model is what i'm using my view to populate the search object but I keep getting null values on submission (placing break point in my controller)
Example field:
@Html.LabelFor(model => model.search.fname)
@Html.EditorFor(model => model.search.fname, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.search.fname, "", new { @class = "text-danger" })
Model passed to view:
WebApp1.MainModel
Is this possible? any ideas?
Seen this also: