在前台界面中点击DropDownList出来的SelectedIndexChanged事件不管用
部分代码如下
<tr>
<td style="text-align:right;">生日:</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server"
onselectedindexchanged="DropDownList2_SelectedIndexChanged1">
</asp:DropDownList>
年
<asp:DropDownList ID="DropDownList3" runat="server"
onselectedindexchanged="DropDownList3_SelectedIndexChanged1"
>
</asp:DropDownList>
月
<asp:DropDownList ID="DropDownList4" runat="server" >
</asp:DropDownList>
日
</td>
<td></td>
</tr>
//改变年份
protected void DropDownList2_SelectedIndexChanged1(object sender, EventArgs e)
{
int year = int.Parse(this.DropDownList2.SelectedItem.ToString()); if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
{
IsLoopYear = 0;
}
} //改变月份
protected void DropDownList3_SelectedIndexChanged1(object sender, EventArgs e)
{
int month = int.Parse(this.DropDownList3.SelectedItem.ToString()); if (month == 2)
{
dsMonth = 2;
}
else if (month == 4 || month == 6 || month == 9 || month == 11)
{
dsMonth = 1;
}
//如果是闰年
if (IsLoopYear == 0 && dsMonth == 2)
{
this.DropDownList4.Items.Clear();
for (int i = 1; i <= 29; i++)
{
this.DropDownList4.Items.Add(i.ToString());
}
}
else if (dsMonth == 2)
{
this.DropDownList4.Items.Clear();
for (int i = 1; i <= 28; i++)
{
this.DropDownList4.Items.Add(i.ToString());
}
}
else if (dsMonth == 1)
{
this.DropDownList4.Items.Clear();
for (int i = 1; i <= 30; i++)
{
this.DropDownList4.Items.Add(i.ToString());
}
}
else
{
this.DropDownList4.Items.Clear();
for (int i = 1; i <= 31; i++)
{
this.DropDownList4.Items.Add(i.ToString());
}
}
}
部分代码如下
<tr>
<td style="text-align:right;">生日:</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server"
onselectedindexchanged="DropDownList2_SelectedIndexChanged1">
</asp:DropDownList>
年
<asp:DropDownList ID="DropDownList3" runat="server"
onselectedindexchanged="DropDownList3_SelectedIndexChanged1"
>
</asp:DropDownList>
月
<asp:DropDownList ID="DropDownList4" runat="server" >
</asp:DropDownList>
日
</td>
<td></td>
</tr>
//改变年份
protected void DropDownList2_SelectedIndexChanged1(object sender, EventArgs e)
{
int year = int.Parse(this.DropDownList2.SelectedItem.ToString()); if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
{
IsLoopYear = 0;
}
} //改变月份
protected void DropDownList3_SelectedIndexChanged1(object sender, EventArgs e)
{
int month = int.Parse(this.DropDownList3.SelectedItem.ToString()); if (month == 2)
{
dsMonth = 2;
}
else if (month == 4 || month == 6 || month == 9 || month == 11)
{
dsMonth = 1;
}
//如果是闰年
if (IsLoopYear == 0 && dsMonth == 2)
{
this.DropDownList4.Items.Clear();
for (int i = 1; i <= 29; i++)
{
this.DropDownList4.Items.Add(i.ToString());
}
}
else if (dsMonth == 2)
{
this.DropDownList4.Items.Clear();
for (int i = 1; i <= 28; i++)
{
this.DropDownList4.Items.Add(i.ToString());
}
}
else if (dsMonth == 1)
{
this.DropDownList4.Items.Clear();
for (int i = 1; i <= 30; i++)
{
this.DropDownList4.Items.Add(i.ToString());
}
}
else
{
this.DropDownList4.Items.Clear();
for (int i = 1; i <= 31; i++)
{
this.DropDownList4.Items.Add(i.ToString());
}
}
}
解决方案 »
- 的对象强制转换为类型“System.Web.UI.WebControls.TextBox”。
- 求一asp.net抽奖程序
- 网上下载的一个系统 每个页面最下面都被加上版权信息 如何更改?
- 请大家推荐一个JS UI框架
- 想请教一下 我先做一个在线的音乐播放器 怎么把后台数据那个url输入前台
- 存储过程问题
- 几个小问题,望各位帮帮忙!
- 关于跨服务器存cookie,求解决办法
- DataGrid中直接編輯模板列
- 要把用了Treeview控件的项目程序传到服务器上,需要做什么?
- 我从网上下的asp.net的源文件,怎么用VS2010打开进行调试
- 我有一个高版本655的数据库,怎么添加到低版本611的数据库呢
AutoPostBack="True">
</asp:DropDownList>