I have a list of class object and which is bind with view like this
@model List<Rep.Models.ContactReportSettingViewModel>
var accountArr = Model.Select(x => new { x.AccountId, x.CarrierId, x.AccountNumber, x.CarrierName, x.ClientId, x.ContactId }).Distinct();
I have a loop here on var object
@foreach (var accountRow in accountArr)
{
@Html.LabelFor(x => accountRow.AccountNumber, accountRow.AccountNumber, new { @id = accountRow.AccountId })
but when I click on save it is returning null or values or not set with the class properties I am accessing this in controller like this:
public RESULT method(List<ContactReportSettingViewModel> model)
{
model is null here
// return View(model);
}
But in model I am getting null. What I am doing wrong?
When I use this
public RESULT method(ContactReportSettingViewModel model)
{
// return View(model);
}
Then in model object I can see all the properties but values does not set to those properties
public ActionResult method(List<class> model)but if its not binding its because you view is wrong. Post your code.[HttpPost]decorated over the action method