Modelbinder不绑定嵌套集合自己的属性

时间:2014-03-15 10:46:24

标签: asp.net-mvc model-binding

我有嵌套集合的复杂对象。我在过去绑定extrem嵌套集合没有问题。但是我的一些集合类现在已经定义了自己的属性。似乎模型绑定器完全忽略了这些属性。

示例:

public class C
{
    public string SomeProperty { get; set; }
}

public class CList : Collection<C>
{
    public string OwnProperty { get; set; }
}


public class Model
{
    public CList CList
    {
        get;
        set;
    }
}

我无法将任何内容绑定到Model.CList.OwnProperty,但集合中的绑定项有效。 名为

的输入

“CList [0] .SomeProperty” - &gt;工作,将项目添加到集合

“CList [1] .SomeProperty” - &gt;工作,将项目添加到集合

“CList.OwnProperty” - &gt;模型绑定器不起作用,不设置集合属性。

0 个答案:

没有答案
相关问题