を行うことができます。
public class SuperModel
{
public string OperationNo { get; set; }
}
//Create an edmx to your table
public class HomeController : Controller
{
[HttpPost]
public ActionResult Index2003(SuperModel sm, FormCollection formCollection)
{
var theId = formCollection.Keys[0];
return View();
}
public ActionResult Index2003()
{
SuperModel sm = new SuperModel { OperationNo = "op1" };
return View(sm);
}
はコントローラー:
@model Testy20161006.Controllers.SuperModel
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index2003</title>
</head>
<body>
<div>
@using (Html.BeginForm())
{
var variable = "456";
@Html.TextBoxFor(item => item.OperationNo, new { Name = "materialCostInput" + variable })
<input type="submit" value="submit" />
}
</div>
</body>
</html>
私はより完全な答えを追加しました。 – kblau