/**/
<asp:DropDownList ID="dropdownlist" runat="server" AutoPostBack="True" OnSelectedIndexChanged="selectchanged">
</asp:DropDownList>
//绑定
dropdownlist.DataSource = ds.Tables[0];
dropdownlist.DataTextField = "name";
dropdownlist.DataValueField = "id";
dropdownlist.DataBind();
protected void selectchanged(object sender, EventArgs e)
{
     //在这个地方取dropdownlist.SelectedIndex总是0,求解;
}

解决方案 »

  1.   


    protected void selectchanged(object sender, EventArgs e)
    {
         //在这个地方取dropdownlist.SelectedIndex总是0,求解;
    }
    不是这个事件、你选择错事件了!SelectIndexchanged
      

  2.   

    数据是有的.
    说2楼对的,你们应该没有看完我的帖子吧.
    函数名称无所谓的,事件应该也是OnSelectedIndexChanged.
    都没有问题.
    dropdownlist的数据我是用datasource绑定的.
    如果不绑定,直接写在aspx页面写死itemlist的话dropdownlist.SelectedIndex的值是会随选择而改变的.