HI Team,
I have asp:AutoCompleteExtender on my page . The user is typing 1 word and heating enter button. Enter generating post back and text box list of search items are disappearing from page. I want to disable the enter button and list of search item should appear in textbox. How i can do that. I tried follow code.
http://stackoverflow.com/questions/14857666/preventing-enter-from-picking-an-item-from-an-auto-complete-list-to-close-moda
<div class="SearchBox">
<div style="float: left"><asp:TextBox ID="txtSubtopic" runat="server" Width="240px" ClientIDMode="Static"></asp:TextBox></div><asp:AutoCompleteExtender ID="AutoCompleteExtender1" TargetControlID="txtSubtopic" runat="server" ServiceMethod="GetCompletionListAll" EnableCaching="true" OnClientItemSelected="txtsubtopic_item_selected" UseContextKey="True" MinimumPrefixLength="1" CompletionSetCount="100" CompletionListCssClass="CompletionListCssClass" FirstRowSelected="true"></asp:AutoCompleteExtender><asp:TextBoxWatermarkExtender ID="tbwmExt" runat="server" BehaviorID="txtSubtopic" TargetControlID="txtSubtopic" WatermarkText="Search data by keyword (ie. Asthma)" WatermarkCssClass="WaterMarkSearch" /></div>
function txtsubtopic_item_selected(source, eventArgs) { var route = window.location.href; var routeData = route.split("?")[0]; window.location.href = routeData + "?" + eventArgs.get_value(); } $(function () {$('#txtSubtopic').bind('keydown', function (e) { debugger; if (e.keyCode == 13) { if ($('#txtSubtopic')._selectIndex !== -1) {$('#txtSubtopic')._setText($('#txtSubtopic')._completionListElement.childNodes[$('#txtSubtopic')._selectIndex]); ev.stopPropagation(); // added line ev.preventDefault(); alert("ale"); } else { // close the popup this.hidePopup(); } } }); });
Thank You in an advance.
Vishal bedre