faiza mushtaq

faiza mushtaq

  • NA
  • 7
  • 2.1k

How Populate Integer values in Dropdown Helper .Net MVC

Aug 6 2016 7:50 AM
I have issue how to populate the integer values like year list in Dropdown helper in MVC without using ViewBag , ViewData.
I try to find out the solution on StackOverflow. But I am facing the error when to load it.
Here my code :
Model:
public IEnumerable<int> StudyYear
{
get
{
var YearsList = new List<int>();
for (int year = 1950; year < 2016; year++)
{
YearsList.Add(year);
}
return YearsList;
}
}
Just need View Dropdown Code how todo it by view.

Answers (1)