6
Answers

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

Marius Vasile

Marius Vasile

4y
1.1k
1
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)