Reputation: 196689
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?
Upvotes: 7
Views: 49270
Reputation: 5550
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.
Upvotes: 10
Reputation: 2033
If you want it to work with the arrow keys, you should use the client side event, onKeyDown
.
Upvotes: 0
Reputation: 827724
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.
Upvotes: 9
Reputation: 16540
I think you have to leave the control if you are using the keyboard in order to fire the event.
Upvotes: 0