ASP.NET / C#: DropDownList SelectedIndexChanged in server control not firing

前端 未结 5 1493
我寻月下人不归
我寻月下人不归 2020-12-30 07:39

I\'m creating a server control that basically binds two dropdown lists, one for country and one for state, and updates the state dropdown on the country\'s selectedindexchan

5条回答
  •  萌比男神i
    2020-12-30 08:19

    You need to set AutoPostBack to true for the Country DropDownList.

    protected override void OnLoad(EventArgs e)
    {
        // base stuff
    
        ddlCountries.AutoPostBack = true;
    
        // other stuff
    }
    

    Edit

    I missed that you had done this. In that case you need to check that ViewState is enabled.

提交回复
热议问题