I want to add choices programmatically to an SPFieldChoice so that its select box has values with Current Year - 5 to Current Year + 5.
What is the best way to do this?
2010 -- current year
Where "spfc" is an object of type SPFieldChoice:
int year = DateTime.Now.Year - 5;
for (int i = 0; i < 10; i++)
spfc.Choices.Add((year + i).ToString());
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
4 years ago
3 years ago