Remark :
form post action
1 2 3 4 5 6 7 8 9 10 11 12 |
public ActionResult Session01Form() { return View(); } [HttpPost] public ActionResult Session11Submit(FormCollection collection) { ViewBag.Username = collection["username"]; return View(); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<h2>Session01Form</h2> @using (Html.BeginForm("Session11Submit", "Home", null, FormMethod.Post, new { id = "MyForm" })) { @Html.Label("username", "User name") @Html.TextBox("username") @Html.TextBoxFor(m =>m.Res.passengers[i].Name, new { @id = "username", @name = "username", @style = "ime-mode:active;", @maxlength = "50" }) <br/> <input type="submit" value="Submit" /> } |
1 2 3 4 5 |
<h2>Session11Submit</h2> Webcome, @ViewBag.username |