Schleid Alex

Schleid Alex

  • NA
  • 361
  • 48.2k

Help finding the problem

Apr 25 2020 9:15 PM
Hi,
I am trying to get a list of month and I have try this
 
Public List<MonthToShow> ddlMonth
{
    for(int i= 1; i < 13; i++)
      {
           List<MonthToShow> monthlist = new List<MonthToShow
             { new MonthToShow { MonthName = monthlist.Add(DateTimeFormatInfo.CurrentInfo.GetMonthName(i),
                MonthValue = i}
      }
            return monthlist;
but it is not working... this is to create a dropdownlist.
 
Thank you!
PS I have class MonthToShow 
{
public string MonthName {get; set;}
public int MonthValue {get; set;}
}

Answers (5)