当我运行它时,下拉列表根本不显示。它出现在较早的时候;我不确定我改变了什么使它不起作用。仅显示提交按钮。
<div class="container">
<h1>Enter Wellness Activity
</h1>
Select Activity Type:<br />
@{
List<Activity> acts = ViewBag.Activities;
var selectItems = new SelectList(acts, "code", "shortTitle");
ViewBag.selectItems = selectItems;
}
<div class="input">
@{
Html.BeginForm("ActivitySelected", "Home");
Html.DropDownList("selectItems");
<br />
<button name="submit" value="Submit">Submit</button>
// Html.EndForm();
}
</div>
</div>