控件渲染

1、动态改变控件

               由银行 -->  代收公司

<select id="ddlLevel" name="ddlLevel" class="input-medium">
         <option value="">@Html.Lang("Font_quanbu") </option>
</select>

<script>
     //绑定等级
        function funBindLevel() {
            $("#ddlLevel").empty();
            var type = parseInt($("#ddlType").val());
            var i = 0;
            if (type !== 0) {
                $("#spWithdraw").hide();
            } else {
                $("#spWithdraw").show();
            }
            if (type === 0 || type === 3) {

                //银行
                common.Ajax({
                    url: "../LoadData/BanksOutStatistic.ashx", data: { "action": "getBank", "type": type }
                }, function (msg) {
                    var jsonBank = eval(msg);
                    $("#ddlLevel").append("<option value=\"-1\">" + jsonCode["Font_yinhang"] + "</option>");
                    for (i = 0; i < jsonBank.length; i++) {
                        $("#ddlLevel").append("<option value=\"" + jsonBank[i].f_bankName + "\">" + jsonBank[i].f_bankName + "</option>");
                    }

                    //使用bootstrap-select渲染
                    $("#ddlLevel").attr("class", "selectpicker input-large  ddlLevel");
                    $("#ddlLevel").attr("data-live-search", "true");
                    $("#ddlLevel").attr("data-style", "btn-white");
                    $("#ddlLevel").attr("data-size", 10);
                    $("#ddlLevel").attr("data-width", 165);
                    $('#ddlLevel').selectpicker('refresh');   //渲染最后要刷新一下
                });
            } else if (type === 1) {
                $('.selectpicker').selectpicker('destroy');//以编程方式销毁bootstrap-select
                //支付宝
                $("#ddlLevel").append("<option value=\"-1\">" + jsonCode["Font_dengjizhangben"] + "</option>");
                for (i = 0; i < 5; i++) {
                    $("#ddlLevel").append("<option value=\"" + i + "\">" + funGetLevelShow(i) + "</option>");
                }
                $("#ddlLevel").append("<option value=\"5\">" + jsonCode["Font_qtzb"] + "</option>");
            } else if (type === 2) {
                //代付
                common.Ajax({
                    url: "@Url.Action("GetYeePayType")"
                }, function (msg) {
                    var dafaryJson = eval("(" + msg + ")");
                    $("#ddlLevel").append("<option value=\"-1\">" + jsonCode["Font_dsgs"] + "</option>");
                    for (i = 0; i < dafaryJson.length; i++) {
                        $("#ddlLevel").append("<option value=\"" + dafaryJson[i].f_type + "\">" + dafaryJson[i].f_name + "</option>");
                    }

                    //使用bootstrap-select渲染
                    $("#ddlLevel").attr("class", "selectpicker input-large  ddlLevel");
                    $("#ddlLevel").attr("data-live-search", "true");
                    $("#ddlLevel").attr("data-style", "btn-white");
                    $("#ddlLevel").attr("data-size", 10);
                    $('#ddlLevel').selectpicker('refresh');
                 });
            }
        }
    </script>
重新渲染控件

 

转载于:https://www.cnblogs.com/SmileSunday/p/9218312.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值