title: How to select multiple items using Autocomplete extender in c#?
body: <p>In my project I am using autocomplete extender.using this I am selecting only one item.But I  want to select multiple items.what I should  I do.please help me. below is my code:</p>
  
  <p>aspx page:</p>
  
  <pre><code>&lt;asp:TextBox ID="TextBox1" runat="server"  CssClass="autosuggest  ui-timepicker-input" Width="300px"&gt;&lt;/asp:TextBox&gt;
  
          &lt;ajaxToolkit:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" DelimiterCharacters=""
              Enabled="True" ServiceMethod="GetListofCountries" MinimumPrefixLength="2" EnableCaching="true" CompletionSetCount="10" CompletionInterval="10"  FirstRowSelected="false"
              TargetControlID="TextBox1"&gt;
          &lt;/ajaxToolkit:AutoCompleteExtender&gt;
  </code></pre>
  
  <p>aspx.cs page:</p>
  
  <pre><code>[System.Web.Script.Services.ScriptMethod()]
          [System.Web.Services.WebMethod]
          public static List&lt;string&gt; GetListofCountries(string prefixText, int count)
          {
              //using (SqlConnection sqlconn = new SqlConnection(ConfigurationManager.ConnectionStrings["con2"].ConnectionString))
              //{
              //    sqlconn.Open();
              //    SqlCommand cmd = new SqlCommand("select UserEmail from [User]  where Useremail like '%" + prefixText + "%'", sqlconn);
              //    cmd.Parameters.AddWithValue("@prefixText", prefixText);
              //    SqlDataAdapter da = new SqlDataAdapter(cmd);
              //    DataTable dt = new DataTable();
              //    da.Fill(dt);
              //    List&lt;string&gt; Emailid = new List&lt;string&gt;();
              //    for (int i = 0; i &lt; dt.Rows.Count; i++)
              //    {
              //        Emailid.Add(dt.Rows[i]["UserEmail"].ToString());
              //    }
              //    return Emailid;
              //}
  
  
  
  
  
              List&lt;string&gt; customers = new List&lt;string&gt;();
              using (SqlConnection conn = new SqlConnection())
              {
                  List&lt;string&gt; terms = prefixText.Split(',').ToList();
                  terms = terms.Select(s =&gt; s.Trim()).ToList();
  
                  //Extract the term to be searched from the list
                  string searchTerm = terms.LastOrDefault().ToString().Trim();
  
                  //Return if Search Term is empty
                  if (string.IsNullOrEmpty(searchTerm))
                  {
                    //  return 
                  }
  
                  //Populate the terms that need to be filtered out
                  List&lt;string&gt; excludeTerms = new List&lt;string&gt;();
                  if (terms.Count &gt; 1)
                  {
                      terms.RemoveAt(terms.Count - 1);
                      excludeTerms = terms;
                  }
  
                  conn.ConnectionString = ConfigurationManager
                          .ConnectionStrings["con2"].ConnectionString;
                  using (SqlCommand cmd = new SqlCommand())
                  {
                      string query = "select UserEmail from [User]  where Useremail like '%" + prefixText + "%'";
  
                      //Filter out the existing searched items
                      if (excludeTerms.Count &gt; 0)
                      {
                          query += string.Format(" and UserEmail not in ({0})", string.Join(",", excludeTerms.Select(s =&gt; "'" + s + "'").ToArray()));
                      }
                      cmd.CommandText = query;
                      cmd.Parameters.AddWithValue("@prefixText", prefixText);
                      cmd.Connection = conn;
                      conn.Open();
                      using (SqlDataReader sdr = cmd.ExecuteReader())
                      {
                          while (sdr.Read())
                          {
                              //customers.Add(string.Format("{0}-{1}", sdr["Userid"], sdr["CustomerId"]));
                              customers.Add(string.Format("{0}", sdr["UserEmail"]));
                          }
                      }
                      conn.Close();
                  }
                  return customers;
  
  
              }
  </code></pre>
  
  <p>but it gives only one value.I want to select multiple items.please help me.</p>