我一直在与这场斗争3天.基本上,我有一个javascript对象发布到MVC控制器.在检查Request.Form.AllKeys namevalueCollection中的属性键名称时,我注意到我的子属性被[]包围,并且MVC模型绑定器不绑定这些值.
The values coming through on the controller look like this:
[6]: "Metadata[ScreenResolution]"
[7]: "Metadata[AudioCodec]"
[8]: "Metadata[VideoCodec]"
[9]: "Metadata[Format]"
My question is why is this happening.
Edit: The "first-level properties are binding successfully, In the javascript, when the javascript object is being created, all the properties are being set correctly from KO"
MVC Model:
public class Movie
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
public string Directors { get; set; …Run Code Online (Sandbox Code Playgroud)