Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
@{
var modelMetadata = ViewContext.ViewData.ModelMetadata;
var values = modelMetadata.AdditionalValues.ContainsKey("SelectList")
? modelMetadata.AdditionalValues["SelectList"] as IEnumerable<SelectListItem>
: Enumerable.Empty<SelectListItem>();
}
@Html.DropDownList("", values, "Choose..")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment