title: how to add year in drop down from past 2 year till present year in asp.net
body: <p>I tried all sorts of code for this,but failed.
  Please help me in filling years in drop down.
  Thank you in advance.</p>
  
  <pre><code>    DropDownList2.Items.Clear();
      DropDownList2.Items.Add("--Year--");
      for (int i = 3;i&gt;=0 ; i--)
     {
         Label1.Text = DateTime.Now.Year . ToString();
         //DateTimeFormatInfo dinfo = new DateTimeFormatInfo();
         int year= int .Parse ( Label1. Text);
         Label1.Text = dinfo.GetMonthName(year);
          int year= DateTime.Now.Year;
          Label1.Text = year.ToString();        
          DropDownList2.Items.Add(year+i+ " ");
     }
  </code></pre>