62,046
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class 出生日期 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList3.Visible = false;
DropDownList4.Visible = false;
DropDownList5.Visible = false;
DropDownList6.Visible = false;
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
string str = DropDownList1.SelectedValue;
string strMonth = DropDownList2.SelectedValue;
int year = int.Parse(str);
int month = int.Parse(strMonth);
if (month == 2)
{
if ((year % 4 == 0) && (year % 100 != 0) || year % 400 == 0)
{
DropDownList3.Visible = false;
DropDownList4.Visible = true;
DropDownList5.Visible = false;
DropDownList6.Visible = false;
}
else
{
DropDownList3.Visible = true;
DropDownList4.Visible = false;
DropDownList5.Visible = false;
DropDownList6.Visible = false;
}
}
else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
{
DropDownList3.Visible = false;
DropDownList4.Visible = false;
DropDownList5.Visible = true;
DropDownList6.Visible = false;
}
else if (month == 4 || month == 6 || month == 9 || month == 11)
{
DropDownList3.Visible = false;
DropDownList4.Visible = false;
DropDownList5.Visible = false;
DropDownList6.Visible = true;
}
}
}