How does Model binding with a selectlist work?

Posted by rsteckly on Stack Overflow See other posts from Stack Overflow or by rsteckly
Published on 2011-01-05T00:37:44Z Indexed on 2011/01/05 7:53 UTC
Read the original article Hit count: 267

Filed under:
|
|

Hi,

I'm having problems retrieving the values of a selectlist in my form collection. I've tried making a viewmodel with an attribute with the same name as the select list.

I'm honestly just realizing I REALLY don't understand how model binding works with selectlists. I've just been assuming that the following conventions apply:

  • Name the select list the same thing as the attribute on the model you want it to bind to.

Apart from that, I really don't get it. I've looked at several books on it and they're useless frankly.

How does a select list work with a) form collection and b) a particular model?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc