证实可用
@{var listSelect = (List<EMMS.Domain.ClassdefineModel>)ViewBag.Allselectlist;} @foreach (var item in listSelect) { if (item.ClassType == 3) { <option value="@item.ClassNo">@item.ClassName</option> } }
<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="'+programme._id+'">'+programme.programme_name+'</option>') } $("#programme_view").html(programme_sel.join(' ')); } }, error : function() { alert('查询节目异常'); } }); }