Marius Vasile

Marius Vasile

  • 595
  • 1.9k
  • 146.4k

ASP.NET Core Razor - post checkbox value as yes or no to database

Nov 14 2020 12:10 AM
I have the following checkbox
 
  1. <input type="checkbox" name="chk1" asp-for="MinPPE.Head" checked data-toggle="toggle" data-on="Not Required" data-off="Required" data-onstyle="danger" data-offstyle="success" data-width="150" data-height="50"/>  
In the database, for MinPPE.Head I want to have Yes if checkbox checked (Required) and No if not (Not Required). How do I build my Post statement?
 
 
 

Answers (6)