I need to be able to define a drop down list in my cshtml. I have some that are populated with the arrays coming from my model view, so I define them as such
@Html.DropDownList("dropdownlist-Id", Model.ValuesForDDL, new { @class = "ddl" })
How do I set the selected value as well? (Please note that I need to be able to set the class too).
you can set the selected value with giving a selectlist object to dropdownlist
ex:
Now the selected item in combo is the item that has id 5