強く型付けされたビューがあり、コントローラーでデータを取得したい。これは私が持っているものです:
@model WordAutomation.Models.Document
@{
ViewBag.Title = "Document";
}
<h2>Document</h2>
@using (Html.BeginForm()) {
@Html.ValidationSummary(true)
<fieldset>
<legend>Document</legend>
<div class="editor-label">
@Html.LabelFor(model => model.CaseNumber)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.CaseNumber)
@Html.ValidationMessageFor(model => model.CaseNumber)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
そして、コントローラーにはこれがあります:
[HttpPost]
public ActionResult Document(FormCollection formValue)
{
string test = formValue[0].ToString();
return View();
}
しかしデータが出てこない。私は何が間違っているのですか?ありがとう