我在模特上课Customer
当我单击 Cshtml 页面上的提交按钮时,
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
<fieldset>
<legend>Registration</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Fname)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Fname)
@Html.ValidationMessageFor(model => model.Fname)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Lname)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Lname)
@Html.ValidationMessageFor(model => model.Lname)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Address)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Address)
@Html.ValidationMessageFor(model => model.Address)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.phoneNo)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.phoneNo)
@Html.ValidationMessageFor(model => model.phoneNo)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Username)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Username)
@Html.ValidationMessageFor(model => model.Username)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Password)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Password)
@Html.ValidationMessageFor(model => model.Password)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.ConfirmPassword)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.ConfirmPassword)
@Html.ValidationMessageFor(model => model.ConfirmPassword)
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
该页面未发布到控制器
[HttpPost]
public ViewResult DisplayCustomer(FormCollection Collection)
{
objinfo.Fname = Request.Form["Fname"].ToString();
objinfo.Lname = Request.Form["Lname"].ToString();
objinfo.Address = Request.Form["Address"].ToString();
objinfo.phoneNo = Request.Form["PhoneNo"].ToString();
objinfo.Username = Request.Form["UserName"].ToString();
objinfo.Password = Request.Form["Password"].ToString();
objutility.InsertEmployee(objinfo);
return View("DisplayCustomer");
}
我无法将值输入request.form
. 我缺少什么特定的代码?