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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -