webtester
webtester

Reputation: 21

Implementing Drop down list in c# using MVC-spark

${Html.DropDownList((SelectList)ViewData["Months"])}

Error: Argument 2: cannot convert from 'System.Web.Mvc.SelectList' to 'string'

Upvotes: 0

Views: 302

Answers (1)

Syneryx
Syneryx

Reputation: 1288

The error is pretty clear, it states that it expects a type of string and you are passing a SelectList make sure you use the correct overloads.

@Html.DropDownList("Months",selectList: ((SelectList)ViewData["Months"]))

Upvotes: 0

Related Questions