C# ASP.NET MVC Forms Adding Form Validation Displaying Validation Messages

Robert Patterson
Robert Patterson
2,915 Points

error: The ViewData item that has the key 'ActivityId' is of type 'System.Int32' but must be of type 'IEnumerable'

@Html.DropDownListFor(m => m.ActivityId, (SelectList)ViewBag.ActivitiesSelectListItems, "", new { @class = "form-control" })

2 Answers

Steven Parker
Steven Parker
148,894 Points

This code line looks OK, my first thought would be that this is not the line that is causing that error message.

You may need to share the complete code to make analysis possible. From a github repo, perhaps?

Robert Patterson
Robert Patterson
2,915 Points

reloaded locally from git hub repository, issue resolved