string Year = DateTime.Now.Date.Year.ToString();
int intYear = Convert.ToInt32(Year)+1;
int chaYear = intYear - 2011;
string[] Yearlist;
Yearlist= new string[chaYear];
for (int i = 0; i < chaYear; i++)
{
Yearlist[i] = (2011 + i).ToString();
}
bcbyear.DataSource = Yearlist;
bcbyear.DataBind();
bcbyear.SelectedIndex = 0;
string[] MonthList;
MonthList = new string[12];
for (int i = 0; i < 12; i++)
{
MonthList[i] = (i+1).ToString("00");
}
Bdpmonth1.DataSource = MonthList;
Bdpmonth1.DataBind();
Bdpmonth1.SelectedIndex = 0;
摘自li_ser的專欄