Need help ...Enter need to disable in asp:AutoCompleteExtender search textbox RRS feed

  • Question

  • User-1571110992 posted

    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.


    <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) {
                    if (e.keyCode == 13) {
                        if ($('#txtSubtopic')._selectIndex !== -1) {
                            ev.stopPropagation(); // added line
                        } else {
                            // close the popup

    Thank You in an advance.

    Vishal bedre

    Tuesday, August 5, 2014 1:22 PM