用DropDownList控件做日期(下拉框)
我做的privatevoidInitData(){ArrayListalYear=newArrayList();ArrayListalMonth=newArrayList...
我做的
private void InitData()
{
ArrayList alYear = new ArrayList();
ArrayList alMonth = new ArrayList();
ArrayList alDay = new ArrayList();
for (int i = 1950; i < 2100; i++)
alYear.Add(i.ToString());
for (int i = 1; i <= 12; i++)
alMonth.Add(i.ToString());
for (int i = 1; i < 32; i++)
alDay.Add(i.ToString());
DDLYear.DataSource = alYear;
DDLYear.DataBind();
DDLMonth.DataSource = alMonth;
DDLMonth.DataBind();
DDLDay.DataSource = alDay;
DDLDay.DataBind();
}
可是2月也可以选择31天,怎样改使2月只有28天,每月的天数正确不会都是31 展开
private void InitData()
{
ArrayList alYear = new ArrayList();
ArrayList alMonth = new ArrayList();
ArrayList alDay = new ArrayList();
for (int i = 1950; i < 2100; i++)
alYear.Add(i.ToString());
for (int i = 1; i <= 12; i++)
alMonth.Add(i.ToString());
for (int i = 1; i < 32; i++)
alDay.Add(i.ToString());
DDLYear.DataSource = alYear;
DDLYear.DataBind();
DDLMonth.DataSource = alMonth;
DDLMonth.DataBind();
DDLDay.DataSource = alDay;
DDLDay.DataBind();
}
可是2月也可以选择31天,怎样改使2月只有28天,每月的天数正确不会都是31 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询