Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: I am having trouble with an MVC checkbox

sharpspoon free asked 4 years ago


Expected behavior I am attempting to use the "Remember Me" part of the following MDB code: https://mdbootstrap.com/snippets/jquery/temp/2288416?action=prism_export#html-tab-view

Actual behavior the checkbox is not showing on the HTML view when using the CheckBoxFor. I need this to retreive the value for the model: @Html.CheckBoxFor(m => m.RememberMe) Remember me

Resources (screenshots, code snippets etc.)


vonmonckl free answered 4 years ago


This code works for me with asp.net 2 and above

<div class="form-check">
         <input type=checkbox asp-for="Input.RememberMe" class="form-check-input" id="checkRemember">
         <label class="form-check-label" asp-for="Input.RememberMe" for="checkRemember"></label>
</div>

sharpspoon free commented 4 years ago

this is for MVC, not ASP



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.19.1
  • Device: desktop
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: Yes