使用HtmlHelper自动生成表单
@using (Html.BeginForm("Reg", "Home"))
{
<p>用户名:@Html.TextBox("LoginId")@Html.ValidationMessage("LoginId")@Html.ValidationMessage("doubleUser")</p>
<p>
密码:
@Html.Password("LoginPwd")
@Html.ValidationMessage("LoginPwd")
</p>
<p>
确认密码:@*<input name="PasswordConfirm" type="password" value="@(Model != null ? Model.PasswordConfirm : "")" />*@
@Html.Password("PasswordConfirm")
@Html.ValidationMessage("PasswordConfirm")
</p>
<p>
姓名:@*<input name="Name" type="text" value="@(Model != null ? Model.Name : "")" />*@
@Html.TextBox("Name")
@Html.ValidationMessage("Name")
</p>
<p>
年龄:@*<input name="Age" type="text" value="@(Model != null ? Model.Age : null)" />*@
@Html.TextBox("Age")
@Html.ValidationMessage("Age")
</p>
<p>
地址:@*<input name="Address" type="text" value="@(Model != null ? Model.Address : "")" /*@
@Html.TextBox("Address")
@Html.ValidationMessage("Address")
</p>
<p>
电话:@*<input name="Phone" type="text" value="@(Model != null ? Model.Phone : "")" />*@
@Html.TextBox("Phone")
@Html.ValidationMessage("Phone")
</p>
<p>
邮箱:@*<input name="Email" type="text" value="@(Model != null ? Model.Email : "")" />*@
@Html.TextBox("Email")
@Html.ValidationMessage("Email")
</p>
<input type="submit" value="注册" />
}