使用ToString() 将null转换为string即可
@Html.DropDownListFor(model => model.AllowedPublished, new List<SelectListItem> { new SelectListItem() { Text = "未审核", Value = (null as bool?).ToString() }, new SelectListItem() { Text = "已通过", Value = "true" }, new SelectListItem() { Text = "未通过", Value = "false" } })
时间: 2024-10-20 16:24:45