I have cut the model back to one field:
//Model
public class LetterViewModel
{
public string LetterText;
}
//Controller
public ActionResult Index()
{
var model = new LetterViewModel();
model.LetterText = "Anything";
return View(model);
}
[HttpPost]
public ActionResult Index(LetterViewModel model)
{
//model.LetterText == null
return View(model);
}
//view
@model Test.Models.LetterViewModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
ViewBag.Title = "Create a Letter";
}
@using (Html.BeginForm())
{
<div id="Bottom">
@Html.TextAreaFor(m => m.LetterText)
<input type="submit" value="Ok" class="btn btn-default" />
</div>
}
When I check the Network tab in dev tools it is showing the value entered is being included in the request. However, when the HttpPost controller is fired the field is empty.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…