ASP.NET Dropdownlist selectedindexchanged event does not shoot up / down arrow

I have a drop down list of servers in an Ajax update. When I use the mouse to click an item, it triggers a postback, but when I press the up / down arrow to change records, it doesn’t work. What could be the reason?

+7
events drop-down-menu
source share
4 answers

Try the following:

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" onKeyUp="this.blur();"> 

With onKeyUp = "this.blur ();" the control will lose focus when the key is not pressed, and this will raise the onChange event.

+9
source share

Try setting the DropPownList control's AutoPostBack property to true .

 <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true"> </asp:DropDownList> 

For more information, see ListControl.AutoPostBack Property on MSDN

Gets or sets a value indicating whether postback on the server will automatically occur when the user changes the list selection.

+10
source share

I think you need to leave the control if you use the keyboard to fire the event.

0
source share

If you want it to work with arrows, you must use the client-side event, onKeyDown .

0
source share

All Articles