mko
mko

Reputation: 7325

JQuery Autocomplete asp.net action not firing on select

Somehow action is not completed when I choose an item from the menu. Everything else works fine, except again - nothing happens when I select an item.

Here is the code:

<script type="text/javascript">

$(document).ready(function() {
    $("#<%=txtSearchTerm.ClientID%>").autocomplete("Acc.ashx", {
        formatItem: function(item) { return item.toString().split("#")[0]; },
        formatResult: function(item) { return item.toString().split("#")[0]; },
        select: function(event, ui) { alert('something'); }
    });

    });


</script>

Upvotes: 1

Views: 714

Answers (1)

mko
mko

Reputation: 7325

I ended up with this working solution

<script type="text/javascript">

$(document).ready(function() {
    $("#<%=txtSearchTerm.ClientID%>").autocomplete("Acc.ashx", {
        formatItem: function(item) { return item.toString().split("#")[0]; },
        formatResult: function(item) { return item.toString().split("#")[0]; }
    });

    $("#<%=txtSearchTerm.ClientID %>").result( function findValueCallback(event, data, formatted)
    {
        if(data)
        {
            $('#<%=hidOID.ClientID %>').val(data[0].toString().split('#')[1]);
        }            
    });

    });


</script>

Upvotes: 2

Related Questions