ASP.NET Drop-Down List OnSelectedIndexChanged not firing

Share on:

When using an OnSelectedIndexChanged event on a drop down list in an ASP.NET page, the event code wasn’t getting executed.

2Sub ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs)
3        'Called when the drop-down is changed
4        Label1.text="Clicked"
5End Sub

The solution was to add AutoPostback="True" to the DropDownList entry, for example

1<asp:DropDownList ID="DropDown1" 
2    runat="server" 
3    OnSelectedIndexChanged="ClickEvent" 
4    AutoPostback="True">