Mvc
topcss opened this issue · 0 comments
topcss commented
不验证某个字段
ModelState.Remove("TID");
多选下拉
PageInfo.Bundles.AddJs("~/Common/param?groups=BBDCLX");
PageInfo.Bundles.AddCss("~/assets/css/select2.min.css");
PageInfo.Bundles.AddJs("~/assets/js/select2.min.js");
@section ScriptLib {
@* 本节可选,用于添加自己编写的js代码 *@
<style>
.clearPadding {
padding: 0 !important;
}
</style>
<script>
// 获取数据字典为JSON数据
function getJsonByDict(dictName) {
var ret = [];
var str = DcqParamGroup[dictName];
if (str) {
var list = str.split(';');
for (var i = 0; i < list.length; i++) {
var kv = list[i].split(':');
ret.push({ id: kv[0], text: kv[1] });
}
}
return ret;
}
$(function () {
$("#EXPORTTYPES").select2({
language: "zh-CN",
placeholder: '请选择',
multiple: true,
allowClear: true,
data: getJsonByDict("BBDCLX")
});
})
</script>
}
<div class="form-group col-md-6">
@Html.LabelFor(model => model.EXPORTTYPES, htmlAttributes: new { @class = "col-xs-12 col-sm-3 col-md-4 control-label no-padding-right" })
<div class="col-xs-12 col-sm-9 col-md-8">
@Html.EditorFor(model => model.EXPORTTYPES, new { htmlAttributes = new { @class = "clearPadding col-xs-12" } })
@Html.ValidationMessageFor(model => model.EXPORTTYPES, "", new { @class = "text-danger" })
</div>
</div>