How do I bind checkboxes to the List property of a view model?

后端 未结 4 1440
暗喜
暗喜 2020-12-11 18:35

I\'ve been reading the various posts on view models and check boxes, but my brain is starting to lock up and I need a little push in the right direction.

Here\'s my

4条回答
  •  不思量自难忘°
    2020-12-11 19:06

    Binding list with view model

    This site handles it very nicely

    https://www.exceptionnotfound.net/simple-checkboxlist-in-asp-net-mvc/

    public class AddMovieVM  
    {
      [DisplayName("Title: ")]
      public string Title { get; set; }
    
    public List Genres { get; set; }
    
    public AddMovieVM()
    {
        Genres = new List();
    }
    }
    

提交回复
热议问题