請高手幫忙解決下~

ricky_lhs 2008-04-17 08:22:00
/// <summary>
/// 定義月和天的數組的值
/// </summary>
private string[] month ={ "請選擇","1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"};
private string[] bigDay = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"};
private string[] smallDay = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" };
private string[] leapDay = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28"};
public void insertItemsToDdl_Year()
{
ddl_Year.Items.Add("--請選擇--");
ddl_Year.Items.Add("--1990--");
ddl_Year.Items.Add("--1991--");
ddl_Year.Items.Add("--1992--");
ddl_Year.Items.Add("--1993--");
ddl_Year.Items.Add("--1994--");
ddl_Year.Items.Add("--1995--");
ddl_Year.Items.Add("--1996--");
ddl_Year.Items.Add("--1997--");
ddl_Year.Items.Add("--1998--");
ddl_Year.Items.Add("--1999--");
ddl_Year.Items.Add("--2000--");

}

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.insertItemsToDdl_Year();
}
}

/// <summary>
/// 顯示月方法
/// </summary>
public void DisplayMonth(string[] months)
{
ddl_Month.Items.Clear();
foreach (string month in months)
{
ddl_Month.Items.Add(month);

}
}
/// <summary>
/// 顯示大月份等於31天的方法
/// </summary>
/// <param name="days"></param>
public void DisplayBigDayByMonth(string[] days)
{
ddl_Day.Items.Clear();
foreach (string bigDay in days)
{
ddl_Day.Items.Add(bigDay);
}

}
/// <summary>
/// 顯示小月份等於30天的方法
/// </summary>
/// <param name="days"></param>
public void DisplaySmallDayByMonth(string[] days)
{
ddl_Day.Items.Clear();
foreach (string smallDay in days)
{
ddl_Day.Items.Add(smallDay);
}

}
/// <summary>
/// 閏年顯示天數地方法
/// </summary>
/// <param name="days"></param>
public void DisplayLeapDayByFebruary(string[] days)
{
ddl_Day.Items.Clear();
foreach (string leapDay in days)
{
ddl_Day.Items.Add(leapDay);
}

}
protected void ddl_Month_SelectedIndexChanged(object sender, EventArgs e)
{
switch (ddl_Month.SelectedIndex)
{
case 1:
DisplayBigDayByMonth(bigDay);
break;
case 2:
DisplaySmallDayByMonth(smallDay);
break;
case 3:
DisplayBigDayByMonth(bigDay);
break;
case 4:
DisplaySmallDayByMonth(smallDay);
break;
case 5:
DisplayBigDayByMonth(bigDay);
break;
case 6:
DisplaySmallDayByMonth(smallDay);
break;
case 7:
case 8:
DisplayBigDayByMonth(bigDay);
break;
case 9:
DisplaySmallDayByMonth(smallDay);
break;
case 10:
DisplayBigDayByMonth(bigDay);
break;
case 11:
DisplaySmallDayByMonth(smallDay);
break;
case 12:
DisplayBigDayByMonth(bigDay);
break;
default:
ddl_Month.Items.Clear();
ddl_Day.Items.Clear();
ddl_Month.Items.Add(new ListItem("--请选择--", "--请选择--"));
ddl_Day.Items.Add(new ListItem("--请选择--", "--请选择--"));
break;
}
}
/// <summary>
/// 顯示1990~2000的月份
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddl_Year_SelectedIndexChanged(object sender, EventArgs e)
{
switch (ddl_Year.SelectedIndex)
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
this.DisplayMonth(month);
break;
default:
ddl_Month.Items.Clear();
ddl_Day.Items.Clear();
ddl_Month.Items.Add(new ListItem("--请选择--", "--请选择--"));
ddl_Day.Items.Add(new ListItem("--请选择--", "--请选择--"));
break;
}
}
我想要顯示點擊1994年和1998年的時候俠士2月份為28天效果的方法,該怎么做?
...全文
13 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复

还没有回复,快来抢沙发~

相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-04-17 08:22
社区公告
暂无公告