> 
> I want to perform **Jquery AutoComplete**. My Autocomplete coding is working fine. But **AutoComplete should work when user select the particular listbox item**
> 
> 
> 

[![This is output window](https://i.stack.imgur.com/vNZZn.png)](https://i.stack.imgur.com/vNZZn.png)

you can see one listbox and one text box. I want autocomplete should work when user select the **StoreID item**.

**Jquery Code**

```
//AUTO COMPLETE
var autoSelectedField = $("#FilterField option:selected").text(); 
if (autoSelectedField === 'StoreID') {
    alert(autoSelectedField);
    $('#txtFilterValue').autocomplete({
        source: 'AutoCompleteHandler.ashx'
    });
}

```

**Autocomplete code**

```
public class AutoCompleteHandler : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        //string selectName = context.Request["columnName"] ?? "";
        string term = context.Request["term"] ?? "";

        List<string> listSelectedColumn = new List<string>();

        string cs = ConfigurationManager.ConnectionStrings["HQMatajerConnectionString"].ConnectionString;

        using (SqlConnection con = new SqlConnection(cs))
        {
            SqlCommand cmd = new SqlCommand("JCF_ac_getItemLookupCode", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@storeid",
                    Value = term
                });

            con.Open();
            SqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                listSelectedColumn.Add(rdr["StoreCode"].ToString());
            }

        }

        JavaScriptSerializer js = new JavaScriptSerializer();
        context.Response.Write(js.Serialize(listSelectedColumn));
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}

```

> 
> The **Autocomplete should work when list item is selected**.
> 
> 
>