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>

  • 相关阅读:
    GNU make manual 翻译(九十九)
    GNU make manual 翻译( 九十五)
    Shell的 for 循环小例子
    makefile中对目录遍历的小例子
    GNU make manual 翻译(九十三)
    GNU make manual 翻译( 一百)
    GNU make manual 翻译( 九十七)
    GNU make manual 翻译( 九十八)
    mapserver4.8.3 的readme.win32的中文翻译文件
    遥控器编程
  • 原文地址:https://www.cnblogs.com/glj1203/p/1868017.html
Copyright © 2011-2022 走看看