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?
views:
13516answers:
4
A:
I think you have to leave the control if you are using the keyboard in order to fire the event.
YonahW
2008-10-26 23:51:55
is there anyway to have this fired right on the up/down arrow?
ooo
2008-10-26 23:56:53
A:
If you want it to work with the arrow keys, you should use the client side event, onKeyDown
.
Paul Prewett
2008-10-27 00:40:30
can you give me an example of how this would work . . and how this can then postback to the server for actions
ooo
2008-10-27 01:06:33
+5
A:
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.
CMS
2008-10-27 02:18:05
however 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();"?
Sander
2009-08-04 12:07:42
A:
Not sure this is what you are after but it may help.
Try setting the 'AutoPostBack' property of the DropDownList control to 'true'.
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true">
</asp:DropDownList>
David HAust
2008-10-27 02:33:11