求助:DropDownList的OnSelectedIndexChanged问题
我想实现当DropListDown1选了学生这个项后,Panel2出现,DropListDown2绑定数据<asp:DropDownList ID="DropDownList1" runat="server" Width="55px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Text="全部" Value=0></asp:ListItem>
<asp:ListItem Text="院系" Value=1></asp:ListItem>
<asp:ListItem Text="专业" Value=2></asp:ListItem>
<asp:ListItem Text="总课程" Value=3></asp:ListItem>
<asp:ListItem Text="具体课程" Value=4></asp:ListItem>
<asp:ListItem Text="公告" Value=5></asp:ListItem>
<asp:ListItem Text="信息" Value=6></asp:ListItem>
<asp:ListItem Text="学生" Value=7></asp:ListItem>
</asp:DropDownList>
<asp:Panel ID="Panel2" runat="server" Visible=false Height="24px" Width="119px">
<span style="font-size: 11pt; color: #339966">选择项:</span>
<asp:DropDownList ID="DropDownList2" runat="server" Width="60px" DataTextField=grade_name DataValueField=grade_ID>
</asp:DropDownList></asp:Panel>
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)<asp:ListItem Text="全部" Value=0></asp:ListItem>
<asp:ListItem Text="院系" Value=1></asp:ListItem>
<asp:ListItem Text="专业" Value=2></asp:ListItem>
<asp:ListItem Text="总课程" Value=3></asp:ListItem>
<asp:ListItem Text="具体课程" Value=4></asp:ListItem>
<asp:ListItem Text="公告" Value=5></asp:ListItem>
<asp:ListItem Text="信息" Value=6></asp:ListItem>
<asp:ListItem Text="学生" Value=7></asp:ListItem>
</asp:DropDownList>
<asp:Panel ID="Panel2" runat="server" Visible=false Height="24px" Width="119px">
<span style="font-size: 11pt; color: #339966">选择项:</span>
<asp:DropDownList ID="DropDownList2" runat="server" Width="60px" DataTextField=grade_name DataValueField=grade_ID>
</asp:DropDownList></asp:Panel>
{
if (int.Parse(DropDownList1.SelectedValue) == 7)
{
Panel2.Visible = true;
string str_dr2 = "select * from lab_grade";
Comm1 co_dr2 = new Comm1();
co_dr2.dr_Bind(str_dr2, DropDownList2);
DropDownList2.DataBind();
}
else
Panel2.Visible = false;
}
怎么我选择了学生后DropListDown2没有反应呢?哪有问题啊?