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>

  • 相关阅读:
    Educational Codeforces Round 19 题解【ABCDE】
    喵哈哈村的魔法考试 Round #14 (Div.2) 题解
    Codeforces Round #408 (Div. 2) 题解【ABCDE】
    喵哈哈村的魔法考试 Round #13 (Div.2) 题解
    喵哈哈村的魔法考试 Round #12 (Div.2) 题解
    April Fools Contest 2017 题解
    Kaggle Titanic solution 纯规则学习
    喵哈哈村的魔法考试 Round #11 (Div.2) 题解
    Codeforces Round #406 (Div. 1) B. Legacy 线段树建图跑最短路
    Codeforces Round #407 div2 题解【ABCDE】
  • 原文地址:https://www.cnblogs.com/glj1203/p/1868017.html
Copyright © 2011-2022 走看看