When I use POST method on the below then I can see nulls in my Controller (when I hover over 'docs' while in debug mode). Why it happens? Both columns have values. I try to pass values from those fields to controller but nothing passes there.
View:
@using (Html.BeginForm("Update", "Home", FormMethod.Post))
{
<table>
<tr>
<td>
@Html.HiddenFor(modelItem => item.Account) //it allows me send values for POST/GET methods
@Html.DisplayFor(modelItem => item.Account)
</td>
<td class="choice">
@Html.TextBoxFor(modelItem => item.PaymentDate, new { @type = "date", @class = "form-control datepicker" })
</td>
<td>
@Html.ActionLink("Save", "Update", "Home", new { nrAccount = item.Account, manualDate = item.PaymentDate },null)
</td>
</tr>
</table>
}
Model:
public class DocumentsModel
{
public string Account { get; set; }
public DateTime? PaymentDate { get; set; }
}
Controller:
[HttpPost]
public ActionResult Update(DocumentsModel docs)
{
//some code
return RedirectToAction("Index");
}