DropDownList为什么老取得同一个值
private void Page_Load(object sender, System.EventArgs e)
{
DropDownList1.DataSource = ds.DefaultView;
DropDownList1.DataMember = "Categories";
DropDownList1.DataBind();
}
private void Button1_Click(object sender, System.EventArgs e)
{
Label1.Text = DropDownList1.SelectedItem.Value;
}
<asp:DropDownList id="DropDownList1" runat="server" DataTextField="CategoryName" DataValueField="CategoryID">
</asp:DropDownList>
<asp:Button id="Button1" runat="server" Width="93px" Height="24px" Text="Button"></asp:Button>
<asp:Label id="Label1" runat="server">Label</asp:Label></FONT>
数据库表里有四个值,可以在列表框里显示,但是点击Button时,Label1.Text的值只能取到第一个值,这是为什么?该怎么解决?