I have a GridView with a TextBox with autoComplete in each of the GridViewRow's rows. I have implemented it and it is working, but I can only get it to work with the first row of the GridView. My problem is how to iterate through all the rows of the GridView and implement the autoComplete function. As you can see at the moment I have just set the row index to zero.
Here is the Query:
<script type="text/javascript">
$(function () {
$('#<%= (GridViewMealData.Rows[0].FindControl("TextBoxFood")).ClientID %>').autocomplete({
source: function (request, response) {
$.ajax({
url: "SearchFoodService.asmx/GetFoodNames",
data: "{ 'FoodName': '" + request.term + "' }",
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
response(result.d);
},
error: function (result) {
alert('There is a problem processing your request');
}
});
},
minLength: 0
});
});
</script>
Here is the TextBox control:
<asp:TextBox ID="TextBoxFood" runat="server"></asp:TextBox>