Hy ...我正在研究@ Html.Dropdownlist。当我在没有bootstrap类的情况下运行此代码时,我可以在屏幕上看到默认文本。但是当我应用bootstrap类时,我无法在屏幕上看到默认文本。
@Html.DropDownList("Time", new List<SelectListItem>
{
new SelectListItem {Text = "08:30-10:00", Value="1", Selected = true},
new SelectListItem {Text = "10:00-11:30", Value="2"},
new SelectListItem {Text = "11:30-01:00", Value="3"},
new SelectListItem {Text = "01:00-02:30", Value="4"},
new SelectListItem {Text = "02:30-04:00", Value="5"},
new SelectListItem {Text = "04:00-05:30", Value="6"}
}, "Select Time", new { @class = "form-control" })
答案 0 :(得分:0)
@Html.DropDownListFor(model => model.ModulesEdit.ProjectID,
new SelectList(ViewBag.FillProject, "ProjectID", "ProjectName"),
"--Select--",
new { @style = "color:black;", @class = "form-control", id = "ddlProjectName" })