首页 > 代码库 > <select> 绑定下拉框

<select> 绑定下拉框

证实可用

  <select name="PaymentWay" class="easyui-combobox filewidth" id="PaymentWay" editable="false">
                                    @{var listSelect = (List<SelectListItem>)ViewBag.paymentWayList;}
                                    @foreach (var item in listSelect)
                                    {
                                        <option value=http://www.mamicode.com/"@item.Value">@item.Text</option>
                                    }
                                </select>

 

 

 

 

<select name="programme" id="programme_view"> </select>

function loadPrograme(){
        $.ajax({
            url : @{VideoLiveAction.programme},
            type : GET,
            async : false,
            datatype : json,
            success : function(data) {
                if(data){
                    var programme_sel=[];
                    programme_sel.push(<option value="" selected>请选择</option>)
                    for(var i=0,len=data.length;i<len;i++){
                        var programme = data[i];
                        programme_sel.push(<option value="http://www.mamicode.com/+programme._id+">+programme.programme_name+</option>)
                    }
                    $("#programme_view").html(programme_sel.join( ));
                }
            },
            error : function() {
                alert(查询节目异常);
            }
        });
    }

 

<select> 绑定下拉框