主题:[讨论]OnSelectedIndexChanged取不到值?
<font color="#ffffff">省份:</font>
<asp:DropDownList ID="idd" runat="server" Width="100px" AutoPostBack="true" OnSelectedIndexChanged="ddlProvince_SelectedIndexChanged">
</asp:DropDownList>
<font color="#ffffff">城市:</font>
<asp:DropDownList id="idc" Width="100px" runat="server">
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
.aspx.cs
ListItem list;
while (oledb_read.Read())
{
list = new ListItem(oledb_read["duqud"].ToString(), oledb_read["idd"].ToString());
this.idd.Items.Add(list);
}
while (oledb_read2.Read())
{
list = new ListItem(oledb_read2["duqud"].ToString(), oledb_read2["idd"].ToString());
this.DropDownList1.Items.Add(list);
}
protected void ddlProvince_SelectedIndexChanged(object sender, EventArgs e)
{
this.Label1.Text = this.idd.SelectedItem.Text;
}
为什么Label1取不到下拉框里的数据呢?
前台的下拉框数据都能正常显示出来,请解。。。
<asp:DropDownList ID="idd" runat="server" Width="100px" AutoPostBack="true" OnSelectedIndexChanged="ddlProvince_SelectedIndexChanged">
</asp:DropDownList>
<font color="#ffffff">城市:</font>
<asp:DropDownList id="idc" Width="100px" runat="server">
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
.aspx.cs
ListItem list;
while (oledb_read.Read())
{
list = new ListItem(oledb_read["duqud"].ToString(), oledb_read["idd"].ToString());
this.idd.Items.Add(list);
}
while (oledb_read2.Read())
{
list = new ListItem(oledb_read2["duqud"].ToString(), oledb_read2["idd"].ToString());
this.DropDownList1.Items.Add(list);
}
protected void ddlProvince_SelectedIndexChanged(object sender, EventArgs e)
{
this.Label1.Text = this.idd.SelectedItem.Text;
}
为什么Label1取不到下拉框里的数据呢?
前台的下拉框数据都能正常显示出来,请解。。。