How to save checkbox multiple values in database


How to save multiple checkbox checked values into the database?

What should be the table structure in the database?

Checkbox values should be populated with static entity.

I can bind the checkbox with static entity , but my problem is that can not save the data in column with comma separated format as it is not normalized data. Also if we create one column for one checkbox then that structure will be fixed , in the future if any new entry is added to the static entity then we need to add one more column for that entry that feature is not dynamic.

Could you please provide me the solution on the same and which should be dynamic?

Thanks in advance!!!


Prachi Kurundkar



What is usually done in such situations is to create an intermediary entity with the Id of the parent entity and the Id of your static entity. So each checked item would be a new record in this new entity. As an example, if your parent entity is called "Employee" and your static entity "Skill", your intermediary entity would look something like this:

  - EmployeeId
  - SkillId