【发布时间】:2014-10-17 16:51:07
【问题描述】:
我有一个视图,用户可以在其中输入一些数据。但问题是这样的: 假设您有 3 个文本框在视图中。每次用户可以多次填写这 3 个文本框。为了澄清,假设用户填写了这 3 个文本框并按下按钮,再次在表单上添加这 3 个文本框。现在当用户点击提交时,这个表单被发送到控制器,但是我如何发送模型列表作为参数。 我的这个问题的架构是这样的:
我的模特
public int ID { get;set; }
public string Something { get; set; }
/*This three textboxes can user set multiple times*/
/*Perhaps i Can create new model with these properties and then
/*put List of that model as property here, but how to fill that list inside view ??*/
public string TextBoxOneValue { get; set; }
public string TextBoxTwoValue { get; set; }
public string TextBoxThreeValue { get; set; }
现在,我在想我用这 3 个文本框创建 PartialView,然后当用户单击视图上的按钮时,会加载另一个 PartialView。
现在,假设我加载了两个部分视图,并且用户单击提交,我如何将具有这 3 个文本框的值的列表传递给控制器?
【问题讨论】:
-
我想这就是你想要的......
标签: view model controller asp.net-mvc-5