开发者

do you have to qualify control property names when using the default asp.net mvc model binder

let say your controller action looks like this:

public ActionResult Update(Car myCar)
{
}

if you have a textbox that has

 <input type='text' name='year' value='1990'>

it seems like it will bind to the myCar.year field just fine

but if you have nested objects or complex lists, etc开发者_开发技巧, it seems like you have to qualify the names of controls like:

 <input type='text' name='myCar.year' value='1990'>

Even though the above is just a simple field, i thought it gets the point across.

the question is, when do you have to "qualify" the input names and when do you not ?


To quote someone who seems to know ... ;)

"if you have nested objects or complex lists, etc, it seems like you have to qualify the names of controls"

You hit the nail on the head, sir!

Kindness,

Dan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜