I have the following POCO classes:
public class Location
{
public int LocationId { get; set; }
public string Name { get; set; }
publi
And another reason: Normally I use the built in editors or displays for and would have never encountered this issue. However in this case I required a semi-custom control. Basically a drop down with lots of data attributes on the options.
What I was doing, for my select tag was:
Now everything was posting back and to the untrained eye it looked like everything should work and bind. However the IdFor helper renders sub models with an underscore. The model binder doesn't interpret underscores as a class hierarchy indicator. What should be separating them is a dot. Which comes from NameFor:
NameFor fixed all my issues.