コントローラー発射ません:MVCアクション
public ActionResult Insert()
{
return View();
}
public ActionResult Insert(Employee emp)
{
Employee emp1 = new Employee();
emp1.insert(emp);
return View();
}
CSHTML
@using (Html.BeginForm("Employee", "Insert", FormMethod.Post))
{
@Html.TextBoxFor(model => model.name)
@Html.TextBoxFor(model => model.Email)
@Html.TextBoxFor(model => model.mob)
<input type="button" value="Register me" />
}
を私は( '私を登録')ボタンをクリックしたときに、私のモデル値を保存する必要があります。前もって感謝します。
それは 'する必要があります' <ボタンタイプを= ... "提出">(と私はあなたの第二の方法は、 '[HttpPost]'持っていると仮定) –