I want to have dropdownlist with months and years from some point in the past to the current month. This is my code:
for (int year = 2009; year <= DateTime.Now.Year; year++)
{
for (int month = 1; month <= 12; month++)
{
DateTime date = new DateTime(year, month, 1);
this.MonthsCombo.Items.Add(
new RadComboBoxItem(date.ToString("Y"),
String.Format("{0};{1}", year, month))); // this is for reading selected value
}
}
How to change that code so the last month would be current month?