using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
namespace Test
{
public class ViewModel{
public IEnumerable<string> Values {get;set;}
public string Test {get;set;}
}
@model Test.ViewModel
@{
Layout = null;
<!DOCTYPE html>
<html lang="en">
<body>
@Html.DropDownListFor(x => x.Test, new SelectList(Model.Values))
</body>
</html>
using System.Web.Mvc;
public class HomeController : Controller
[HttpGet]
public ActionResult Index()
var values = Enum.GetNames(typeof(Test));
return View(new ViewModel{Values = values});
public enum Test {
Zero = 0,
One = 1,
Two = 2