【发布时间】:2013-04-10 21:44:26
【问题描述】:
我正在尝试填充嵌套模型
模型看起来像这样
public Layout {
public List<Record> Records {get;set;}
}
public Record {
public List<PlaceHolder> PlaceHolders {get;set;}
}
public PlaceHolder {
public string Label {get;set;}
}
当我的表单使用 fiddler 发布时,我看到值与格式中的键一起下降
Records.Index = 0
Records.PlaceHolders.Index = 0
Records[0].PlaceHolders[0].Label = foo
Records.Index = 0
Records.PlaceHolders.Index = 1
Records[0].PlaceHolders[1].Label = bar
Records.Index = 1
Records.PlaceHolders.Index = 1
Records[1].PlaceHolders[1].Label = boo
...
其中很多 KeyNames 我必须使用部分视图自己生成,用 HtmlFieldPrefix 集填充 TemplateInfo。
当我查看我的保存控制器时,布局只是部分填充。它在 Records 属性中包含所有记录。但没有任何记录包含 PlaceHolders。
我的帖子键有什么问题?
【问题讨论】:
标签: asp.net-mvc http-post