Strongly typed view with a SelectList for DropDownList via ViewData: type mismatch on submit
- 阅读更多 关于 Strongly typed view with a SelectList for DropDownList via ViewData: type mismatch on submit
问题 I am trying to create a form in ASP.NET MVC2 RC 2 that is based on a calendar event object. The object has eventTypeId which is a System.Int32 that I need to populate with via a select list. The controller to create the initial view is: [WAuthorize] public ActionResult AddCalendarEvent() { CalendarEventTypesManager calendarEventTypesManager = new CalendarEventTypesManager(); ViewData["eventTypeId"] = new SelectList( calendarEventTypesManager.SelectAll(), "Id", "Type"); return View(); } The