title: how to generate previous year in C#
body: <pre><code>  private void GenerateYear()
      {
          drpYear.Items.Clear();
          int Currenyear = DateTime.Now.Year;
  
          for (int i = Currenyear; i &gt;= 1990; i--)
          {
              drpYear.Items.Add(i.ToString());
          }
          drpYear.SelectedValue = Currenyear.ToString();
      }
  
      private void GenerateMonth(bool SetCurruntMonth, DateTime currentDate)
      {
          drpMonth.Items.Clear();
          int year = drpYear.SelectedIndex != 0 ? ((drpYear.SelectedValue != "") ? Convert.ToInt32(drpYear.SelectedValue) : currentDate.Year)
                              : currentDate.Year;
  
          int months = (currentDate.Year == year) ? currentDate.Month : 12;
          for (int i = 1; i &lt;= 12; i++)
          {
              drpMonth.Items.Add(new ListItem(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i), i.ToString()));
          }
          if (SetCurruntMonth == true &amp;&amp; currentDate.Year == year)
          {
              if (currentDate.Month &gt;= 1)
                  drpMonth.Items.FindByValue(currentDate.AddMonths(-1).Month.ToString()).Selected = true;
              else
                  drpMonth.Items.FindByValue("1").Selected = true;
          }
          else
          {
              drpMonth.SelectedIndex = 0;
          }
      }
  </code></pre>
  
  <p>i done this ....i'm loading previous month in dropdown,,,but when change jan 2014,,the month dropdown is showing december but year dropdown showing 2014,,,</p>
  
  <p>Note:i'm taking year,month from system date</p>