Click here to Skip to main content
15,919,178 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
I want to pass multiple parameters ( ID and Name ) to the autocomplete script. It works if i put only one parameter but not working with two parameters.

This is not working

JavaScript
<script type="text/javascript">

function BindEvents() {

$(document).ready(function () {

$("#<%=txtID.ClientID%>")+$("#<%=txtName.ClientID%>").autocomplete('../../Common_Search/Employee.ashx');

});

}

</script>



This is working

JavaScript
<script type="text/javascript">

function BindEvents() {

$(document).ready(function () {

$("#<%=txtID.ClientID%>").autocomplete('../../Common_Search/Employee.ashx');

});

}

</script>
Posted
Updated 1-Sep-15 17:00pm
v2
Comments
Sergey Alexandrovich Kryukov 1-Sep-15 15:26pm    
Not clear. What parameter do you mean (at least one in your sample)? And how two should work, exactly?
—SA
Robymon 1-Sep-15 15:51pm    
Parameters are ID Number and Name and the Result should display based on these.when we type from the Name Text box it should populate the value.
Sergey Alexandrovich Kryukov 1-Sep-15 15:55pm    
(Sigh...) Not clear. There are no ID number and Name in your code. That why I suggested to point out what is "parameter" in the code sample you show.
More importantly, you did not explain how autocomplete should work. If you have a list of strings, it's clear: you start to enter the string, the closest from a list is auto-suggested. Do you mean that you need to have a list of ID and a list of Name, or some other collection containing both? But then, how do you think it should work, from the user's standpoint?
—SA

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900