This is my ViewModel
public class SaleOrderViewModel
{
public SO SaleOrder { get; set; }
public List<SOD> SaleOrderDetail { get; set; }
public IQueryable<Product> Products { get; set; }
public Product Product { get; set; }
}
i want to post and validate only some properties of SaleOrder and SaleOrderDetail. other properties are null or not required for posting.
this is my post method
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([SaleOrderViewModel saleOrderViewModel)
{
if (ModelState.IsValid)
{
//more code
}
}
but ModelState.IsValid is always false.
how i can include and bind only some properties of view model?