폼을 게시하려고 할 때 컨트롤러 null에있는 메서드의 매개 변수보다 깁니다. 그렇다면 코드에 어떤 문제가 있습니까? 페이지의 소스에서컨트롤러에 전달 된 매개 변수가 null입니다.
index.cshtml
@using (Html.BeginForm("Index", "Settings", FormMethod.Post, new { id = "test1" }))
{
<input type="submit" name="SaveButton" value="Save" />
}
Settingscontroller-
[HttpPost]
public ActionResult Index(string id)
{
return View();
}