[AllowAnonymous]
public ActionResult Register()
{
ViewBag.roleList = DALUser.GetRoleList();
ViewBag.stateList = DALUser.GetStateList();
return View();
}
<li>
@Html.LabelFor(m => m.role)
@Html.DropDownListFor(m => m.role, new SelectList(ViewBag.roleList, "Select Role"))
</li>
“值不能为空参数名:项目”。 roleList和stateList 只是字符串列表
任何人有一个想法呢?
试试这个:new SelectList((列表 ViewBag.roleList,“Select Role”)) –