I need a combo box for an ASP.NET project, so I decided to use the Ajax Control Toolkit combo box ( http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ComboBox/ComboBox.aspx ).
I don’t want to use postback because I don’t want the page to reload, but I need to know when the text in the text box has changed, so I can go to the server to save the new list item.
I'm curious how I bind an onchange or onblur event to the input field that this combobox uses.
This is my asp.net page:
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<cc1:ComboBox ID="PlantDropDown" runat="server" OnInit="PlantDropDown_Init" DropDownStyle="DropDown"
AutoCompleteMode="SuggestAppend"
ItemInsertLocation="OrdinalText" AutoPostBack="false">
</cc1:ComboBox>
Update: I tried using this sentence and I get this error:
$find("PlantDropDown") is null
[Break on this error] $find('PlantDropDown').add_propertyChanged(function(sender, e) {\r\n
jQuery javascript, , , .
:
crescentfresh, .aspx :
<input type="hidden" id="PlantDropDownID" value="<%= PlantDropDown.ClientID %>" />
javascript, javascript .aspx:
elem = document.getElementById('PlantDropDownID');
$find(elem.value).add_propertyChanged(function(sender, e) {
if (e.get_propertyName() == 'selectedIndex') {
var newValue = sender.get_textBoxControl().value;
}
})