I got model and inside model we got "IsActive" with bool type. I want is when "IsActive" comes our View by "true", checkbox also start with checked and if it comes with "false" checkbox unchecked. How can i do that? Thanks for helping me!
<input type="checkbox" id="switch"/>
CodePudding user response:
Use the checked
attribute:
<input type="checkbox" id="switch" checked="@Model.IsActive" />