How to switch the toggle switch through the database

1

I'm trying to change the bool to true or false in the database by changing the toggle switch to true or false.

<script>
$(document).ready(function () {
    for (var i = 0; i < '@Model.Participantes.Count()'; i++) {
        if ($('#Participantes_' + i + '__ID').val() == "true")
            $(".botaoConfirmacao[data-rowindex='" + i + "']").prop('checked', true).change();
        else
            $(".botaoConfirmacao[data-rowindex='" + i + "']").prop('checked', false).change();
        i++;
    }

    $('.botaoConfirmacao').change(function (event) {
        event.preventDefault();
        if ($(this).prop('checked')) {
            $('#' + $(this).attr('id')).val('true');
        }
        else {
            $('#' + $(this).attr('id')).val('false');
        }
    });
 });

    
asked by anonymous 31.05.2017 / 11:54

0 answers