开发者

CheckboxList, MVC, Many-To-Many Relationship

开发者 https://www.devze.com 2023-02-15 02:31 出处:网络
I have a Request class and a Building class with a many to many relationship. A Request can be associated with 1 or more Buildings. I want to take advantage of EditorTemplates to generate checkboxes f

I have a Request class and a Building class with a many to many relationship. A Request can be associated with 1 or more Buildings. I want to take advantage of EditorTemplates to generate checkboxes for each building and check them if associated with the Request.

This might seem like a bit of a loaded question but I'm familiar with EditorTempaltes, ViewModels, etc. I'm just not quite sure how to wire the two up with a many-to-many relationship and checkboxes.

  1. Do I need to add a bool property to my Building class to indicated checked status?
  2. For the EditorTemplate how do I indicated status of checked with the many-to-many relationship?
  3. Should I add 开发者_运维知识库an IEnumerable<Building> to my Request viewmodel?


See Many to many checkbox and mvc

0

精彩评论

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