下拉事件不会在asp.net中触发

时间:2016-09-19 07:37:02

标签: asp.net

protected void dd_State_SelectedIndexChanged(object sender, EventArgs e)
{
    DataView dv_City = dt_City.DefaultView;

    dv_City.RowFilter = "StateID='" + dd_State.SelectedValue + "'";
    dv_City.Sort = "DistrictName";

    dd_City.DataSource = dv_City;
    dd_City.DataTextField = "DistrictName";
    dd_City.DataValueField = "DistrictId";
    dd_City.DataBind();

    dd_City.Items.Insert(0, "--Select City--");
}

我已将autopostback设为true并启用viewstate为true。仍然在调试时它不会去下拉选择索引。事件不会发生。

1 个答案:

答案 0 :(得分:0)

尝试设置

ViewStateMode="Enabled"

有关详情,请查看thisthis