AspNet MVC ViewData Error: InvalidOperationException: There is no ViewData item of type 'IEnumerable<SelectListItem>' that has key 'Type'

Question: How do you resolve the error: InvalidOperationException: There is no ViewData item of type 'IEnumerable<SelectListItem>' that has key 'Type' in MVC asp.net 6 View?

 

 


Write an Article
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

Jack said:

Check your ViewBag it is clear the ViewData is empty while the DropDown Html Tag tries to bind the values. Check for Null Exception first before binding your ListItems.


© 2022 - ErnesTech - Privacy