@Html.DevExpress().ComboBoxFor(m =>m.MODULE_ID,settings => {
settings.Width = 120;
settings.Name = "module_id";//是server对应的字段
settings.Properties.DropDownStyle = DropDownStyle.DropDown;
settings.Properties.TextField = "module_name";
settings.Properties.ValueField = "id";
settings.Properties.NullText = "请选择";
//settings.Properties.ValueType = typeof(int);根据字段类型指定相关类型
settings.Width = 120;
settings.Name = "module_id";//是server对应的字段
settings.Properties.DropDownStyle = DropDownStyle.DropDown;
settings.Properties.TextField = "module_name";
settings.Properties.ValueField = "id";
settings.Properties.NullText = "请选择";
//settings.Properties.ValueType = typeof(int);根据字段类型指定相关类型
}).BindList(ViewBag.Modules).Bind(Model.MODULE_ID).GetHtml()
完整的例子,例子说明
BindList 里面的是一个 对象,要显示的列表 ,数值显示是在TextField,ValueField中设置,而 Bind 里面是默认的值
如果想初期选择的时候什么都没有,就用ComboBox,且吧(m =>m.MODULE_ID,就是一个自选下拉了NullText是默认提示