ASP.NET MVC3:您可以发布和绑定对象的数组? [英] ASP.NET MVC3: Can you post and bind an array of objects?
问题描述
我已负责创建一种形式,其允许用户以一个或多个组答案添加到它的工作。例如,它们将使得从下拉,然后将添加另一组输入到表单的选择。他们可以重复几次这个过程X号。
I have been tasked with the job of creating a form that allows a user to add one or more groups of answers to it. For example, they will make a selection from a drop down which will then add another set of inputs to the form. They can repeat this process X number of times.
什么是处理这种加工的服务器上条件最好的方法是什么?
What's the best way to handle this in terms of processing on the server?
我明白,我可以每个元素可能绑定到一个列表,然后通过每个列表知道在每个列表中的每个值循环用索引链接
I understand I could probably bind each element to a list, and then loop through each list knowing each value in each list was 'linked' by index.
但是,有没有更好的办法?希望这是有道理的。我没有例如code作为呢。
But is there a better way? Hope this makes sense. I don't have example code as of yet.
推荐答案
看看下面的文章,他们是值得您考虑
的http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/
的http://zahidadeel.blogspot.com/2011/05/master-detail-form-in-aspnet-mvc-3-ii.html
<一href="http://ivanz.com/2011/06/16/editing-variable-length-reorderable-collections-in-asp-net-mvc-part-1/" rel="nofollow">http://ivanz.com/2011/06/16/editing-variable-length-reorderable-collections-in-asp-net-mvc-part-1/
如果你是进入淘汰赛JS,你也可以考虑
的http://blog.stevensanderson.com/2010/07/12/editing-a-variable-length-list-knockout-style/
have a look at following articles they are worth your consideration
http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/
http://zahidadeel.blogspot.com/2011/05/master-detail-form-in-aspnet-mvc-3-ii.html
http://ivanz.com/2011/06/16/editing-variable-length-reorderable-collections-in-asp-net-mvc-part-1/
if you are into knockout js you can also consider
http://blog.stevensanderson.com/2010/07/12/editing-a-variable-length-list-knockout-style/
这篇关于ASP.NET MVC3:您可以发布和绑定对象的数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!