Mark Tabor

Mark Tabor

  • 569
  • 1.9k
  • 430.1k

CheckboxFor in MVC using Razor view

Sep 25 2019 12:20 AM
Hi I am creating Dynamic Forms in which i have textboxes and checkboxes as well , i was using html input type for checkbox but it is not getting value and while submitting the form it says that your checkbox column like Active column does not have a valid value i found on internet and find that i need to use @html.checkboxFor rather than html tags so how do i write the below line with html.checkboxfor 
<input type="checkbox" id="educations[0].IsActive" name="educations[0].IsActive" class="css-checkbox9 all_check" />
as i have educatuons[0].isActive as the model item is an array  

Answers (5)