ASP.NET Dropdownlist selectedindexchanged event not firing on up / down arrow
49,158
Solution 1
Try this:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" onKeyUp="this.blur();">
With onKeyUp="this.blur();" the control will lose focus when a key is unpressed, and that will trigger the onChange event.
Solution 2
Try setting the 'AutoPostBack' property of the DropDownList control to 'true'.
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true">
</asp:DropDownList>
See ListControl.AutoPostBack Property on MSDN for more info
Gets or sets a value indicating whether a postback to the server automatically occurs when the user changes the list selection.
Author by
leora
Updated on July 09, 2022Comments
-
leora almost 2 years
I have a server dropdownlist in an Ajax updatepanel. When I use the mouse to click on an item it fires the postback but when I click the up/down arrow to change entries, this is not firing. What could be reason?
-
leora over 15 yearsis there anyway to have this fired right on the up/down arrow?
-
Sander almost 15 yearshowever nice this solution may be, you are killing functionality, if you have a list with 10 items, and the user decides to navigate by keyboard, he exits the dropdownlist every time he clicks up or down. is it possible to do onKeyUp="this.blur();this.focus();" ?
-
Shinigamae about 11 yearsalthough this didn't work out for me. But worth a try and need to take note :)