locked
Permanent check using ASP.Net RRS feed

  • Question

  • User-1790113996 posted

    Good day to all,

    kindly ask if my code is correct to check permanent  the checkbox, please refer my code below, thank you.

    <td>
    @Html.EditorFor(m => m[i].PMFLG, new {@id="check" })
    </td>
            
           
            
            $('#check').change(function () {
                var status;
                if ($('#check').is(':checked')) {
                    status = "checked"
                } else {
                    status = "unchecked"
                }
            });
    Thursday, December 14, 2017 8:20 AM

Answers

  • User-832373396 posted

    Hi <g class="gr_ gr_69 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="69" data-gr-id="69">Cloudfiers</g>,

    @Html.EditorFor(

    Based on your code, please modify a bit:

    <td>
    @Html.CheckBoxFor(m => m[i].PMFLG, new {@id="check" })
    </td>

    and js;

     $('#check').change(function () {
                var status;
                if ($(this).is(':checked')) {
                    status = "checked"
                } else {
                    status = "unchecked"
                }
            });

    Reference: https://api.jquery.com/prop/  

    and @Html.CheckboxFor usage with default true value:

    @Html.CheckBoxFor(m => m.SomeBooleanProperty, new { @checked = "checked" });

    With regards, Angelina Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 15, 2017 2:37 AM