| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 688 人关注过本帖
标题:求助:DropDownList的OnSelectedIndexChanged问题
只看楼主 加入收藏
yunj1105
Rank: 1
等 级:新手上路
威 望:1
帖 子:757
专家分:0
注 册:2007-2-13
收藏
 问题点数:0 回复次数:2 
求助: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)
{
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没有反应呢?哪有问题啊?
搜索更多相关主题的帖子: DropDownList ListItem asp Text 
2007-04-18 11:21
Kendy123456
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:62
帖 子:2720
专家分:0
注 册:2007-1-3
收藏
得分:0 
1.你看你的dropdownlist的autopostback是不是设置为true了
2.如果上步为真仍然有这个问题 你用selectedindex = 7 试试

2007-04-18 11:25
yunj1105
Rank: 1
等 级:新手上路
威 望:1
帖 子:757
专家分:0
注 册:2007-2-13
收藏
得分:0 
恩,解决了,是autopostback没设置谢谢

2007-04-18 11:30
快速回复:求助:DropDownList的OnSelectedIndexChanged问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012281 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved