c# - MVC 4 DropdownListfor error -
[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>
it causes
"value cannot null. parameter name: items". rolelist , statelist string list
anyone has idea on this?
generally speaking, see error when give selectlist
constructor null value. need put breakpoint on viewbag.rolelist = daluser.getrolelist();
, verify other null
being returned. remember, default value of ilist
object null
.
Comments
Post a Comment