1
Answer

How Populate Integer values in Dropdown Helper .Net MVC

faiza mushtaq

faiza mushtaq

8y
195
1
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)