Model Binding not working

后端 未结 10 1438
别那么骄傲
别那么骄傲 2021-02-06 01:52

I have the following POCO classes:

public class Location
    {
        public int LocationId { get; set; }
        public string Name { get; set; }
        publi         


        
10条回答
  •  独厮守ぢ
    2021-02-06 02:21

    Just to reiterate what Tod was saying, the model binder needs a 'name' attribute on the HTML element to map the properties. I was doing a quick test form by hand and only used the 'id' attribute to identify my elements.

    Everything fell into place when I added the 'name' attribute.

    
    

提交回复
热议问题