Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Dropdownlist selectedindexchanged event not firing on up / down arrow

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?

like image 200
leora Avatar asked Oct 26 '08 23:10

leora


2 Answers

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.

like image 196
Dhaust Avatar answered Nov 09 '22 14:11

Dhaust


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.

like image 20
Christian C. Salvadó Avatar answered Nov 09 '22 14:11

Christian C. Salvadó