我们有一些C#模型public class PartnerRegistrationForm{ public string Name { get; set; } public string Company { get; set; } public string Email { get; set; }}包含此模型的类public class PartnerRegistrationFormHolder{ public PartnerRegistrationForm PartnerRegistrationForm { get; set; }}看法@model WebApplication1.Models.PartnerRegistrationFormHolder@using (Html.BeginForm("Index", "Registration", FormMethod.Post)){ @Html.TextBoxFor(e => e.PartnerRegistrationForm.Name) @Html.TextBoxFor(e => e.PartnerRegistrationForm.Email) @Html.TextBoxFor(e => e.PartnerRegistrationForm.Company) <button type="submit">Send</button>}此方法TextBoxFor创建长名称(如“ PartnerRegistrationForm.Company”)的输入好,它的反射魔力然后我填写此表格并提交我有看法[HttpPost]public ActionResult Index(PartnerRegistrationFormHolder partnerRegistrationFormHolder){ return new HttpNotFoundResult();}我使用调试运行程序,并在此操作上设置了断点MVC如何从表单创建对象?谁能解释我或给我一些链接以阅读?
1 回答
- 1 回答
- 0 关注
- 136 浏览
添加回答
举报
0/150
提交
取消