zoukankan      html  css  js  c++  java
  • MVC根据数据库形成 checkbox

    function EditImxUserRole(userintno) {
        $("#AddUserDiv").hide();
        $("#hideUserIntNo").val(userintno);

        $.post(ROOTPATH + "/Admin/GetAllUserRole", {}, function(userroleEntity) {

        }, 'json');


        $.post(ROOTPATH + "/Admin/GetImxUserRoles",
                {
                    UserIntNo: userintno
                },
                function(imxuserrolejoinentity) {
                    $("input:checkbox").attr("checked", false);
                    $.each(imxuserrolejoinentity, function(i, item) {
                        $("#" + item.UserRoleId + "").attr("checked", true);
                    })
                    $("#UserRoleDiv").show();
                }, 'json');

    }


    function UpdateRole() {
        var arrChk = $("input[@type='checkbox'][checked]");
        var id = '';
        $(arrChk).each(function() {
            id += this.id + ',';
        });

        $.post(ROOTPATH + "/Admin/UpdateUserRole",
                {
                    UserIntNo: $("#hideUserIntNo").val(),
                    Role: id
                },
                function(message) {
                    if (message.Status == true) {
                        window.location.reload();
                    }
                    else {
                        alert(alertoperation);
                        window.location.reload();
                    }

                }, 'json');
    }

    <div id="UserRoleDiv">
            <%foreach (SIL.IMX.DAL.Entities.ImxUserRole role in Model.ImxUserRoles)%>
            <%{ %>
            <input type="checkbox" id="<%=Html.Encode(role.UserRoleId) %>" name="userrole" value="<%=Html.Encode(role.UserRoleId) %>" /><%=Html.Encode(role.UserRoleName) %>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <%} %>
            <br />
            <input type="button" id="SaveRole" class="button" value="<% =Html.Resource("SaveRole.Text")%>" name="saverole" onclick="UpdateRole();" />
        </div>

  • 相关阅读:
    【PyQt5-Qt Designer】QSpinBox-微调框
    【PyQt5-Qt Designer】QProgressBar() 进度条
    【PyQt5-Qt Designer】QSlider滑块
    Tomcat eclipse 启动时一个工程影响另一个工程
    apache thrift 和 apache jersey 记录
    常用 Linux 命令
    mac 命令记录
    eclipse m2eclipse 从Maven的本地库中读取依赖库
    成功build Maven但eclipse中依然显示该工程有错误
    mac install: /usr/bin/unrar: Operation not permitted
  • 原文地址:https://www.cnblogs.com/glj1203/p/1868017.html
Copyright © 2011-2022 走看看