I just used jquery ui, I found no solution to having a postback on an autocomplete, it just doesn't work in IE.
I read up on it online, and that's the conclusion
Question
Only on IE, the textbox postback is triggered when the user scrolls the autocomplete results. I have no problems in Chrome or FF.
<asp:TextBox ID="txtBreakfast" ClientIDMode="Static" CssClass="headerinput" AutoPostBack="true" runat="server" OnTextChanged="txtBreakfast_TextChanged"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="txtBreakfast_AutoCompleteExtender" runat="server" UseContextKey="true" ContextKey="" Enabled="True" ServicePath="/service/service1.asmx" ServiceMethod="GetFoodNames" MinimumPrefixLength="1" CompletionSetCount="10" TargetControlID="txtBreakfast" CompletionInterval="500" CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";,:" ShowOnlyCurrentWordInCompletionListItem="true">
</ajaxToolkit:AutoCompleteExtender>
How it's supposed to work: User starts typing food, then selects the food from the extender div, then a postback occures and it causes additional database information to be displayed based on the food.
Solution 3
I just used jquery ui, I found no solution to having a postback on an autocomplete, it just doesn't work in IE.
I read up on it online, and that's the conclusion
OTHER TIPS
if you remove
AutoPostBack="true" runat="server" OnTextChanged="txtBreakfast_TextChanged"
it works?
after the textbox text is changed(you select a value from the dropdown list) the event OnTextChanged is triggered..
You need to remove AutoPostBack="true"
and do the PostBack manually. Add a JavaScript function to do the PostBack, and add OnClientItemSelected
to the AutoCompleteExtender to use it.
function BreakfastChanged() {
__doPostBack("txtBreakfast", "");
}
<asp:TextBox
ID="txtBreakfast"
ClientIDMode="Static"
CssClass="headerinput"
runat="server"
OnTextChanged="txtBreakfast_TextChanged">
</asp:TextBox>
<ajaxToolkit:AutoCompleteExtender
ID="txtBreakfast_AutoCompleteExtender"
runat="server"
UseContextKey="true"
ContextKey=""
Enabled="True"
ServicePath="/service/service1.asmx"
ServiceMethod="GetFoodNames"
MinimumPrefixLength="1"
CompletionSetCount="10"
TargetControlID="txtBreakfast"
CompletionInterval="500"
CompletionListCssClass="autocomplete_completionListElement"
CompletionListItemCssClass="autocomplete_listItem"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
DelimiterCharacters=";,:"
ShowOnlyCurrentWordInCompletionListItem="true"
OnClientItemSelected="BreakfastChanged">
</ajaxToolkit:AutoCompleteExtender>