<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"
type = "text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"
type = "text/javascript"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"
rel = "Stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
InitAutoCompl();
});
function InitializeRequest(sender, args) {
}
function EndRequest(sender, args) {
InitAutoCompl();
}
function InitAutoCompl() {
$("#txtSearch").autocomplete({
source: function (request, response) {
$.ajax({
url: '<%=ResolveUrl("~/Service.asmx/GetCustomers") %>',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
multiple: true,
width: 400,
minChars: 2,
cacheLength: 1,
multipleSeparator: " ",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
error: function (response) {
alert(response.responseText);
},
failure: function (response) {
alert(response.responseText);
}
});
},
select: function (e, i) {
$("#<%=hfCustomerId.ClientID %>").val(i.item.val);
var origEvent = event;
while (origEvent.originalEvent !== undefined)
origEvent = origEvent.originalEvent;
if (origEvent.type == 'keydown')
$("#bttnSearch").click();
return true;
},
minLength: 1
});
}
</script>
this is what i got till now. What is my problem is
1) when i hover over the popup lists using keyboard navigation key it displays items in text box, but when I use mouse it doesn't display in textbox.(?).
2) when i select the list item it gets selected in text box but does not fire text box textchange event.(?).
my aspx
<asp:UpdatePanel ID="up" runat="server"><contenttemplate>
<asp:HiddenField ID="hfCustomerId" runat="server" />
<asp:Label ID="lblEmpCodeSrch" runat="server" Text="EmpCode" CssClass="label">
<asp:TextBox ID="txtSearch" runat="server" Width="815px" ToolTip="Enter Employeecode"
ontextchanged="txtSearch_TextChanged">
<asp:Button ID="bttnSearch" runat="server" CssClass="submit" Height="23px" Text="Search" onclick="bttnSearch_Click" />
</contenttemplate>
Here I tried to explain my question properly. Any help appreciated.