ASP.NET - AutocompleteTextBox with and without using web Services in asp.net with c#?

Asked By Ranjan on 09-Aug-12 07:11 AM
  AutocompleteTextBox with and without using web Services in asp.net with c#?
Peter Bromberg replied to Ranjan on 09-Aug-12 07:54 AM
You can use a static WebMethod (called Page Method) in the ASPX page.
Ranjan replied to Peter Bromberg on 10-Aug-12 01:32 AM
thanks  I already used method .My code is below:

 [System.Web.Script.Services.ScriptMethod()]
        [System.Web.Services.WebMethod]


        public static List<string> GetCompletionList(string prefixText, int count)
        {
           
                string strcon = "Server=AAAA;Database=AAr=AAAPassword=AAAr";


                MySqlConnection con = new MySqlConnection(strcon);
                con.Open();
                MySqlCommand cmd = new MySqlCommand();




                cmd = con.CreateCommand();


                string query1 = "select Emp_First_Name from emp_master  Where  Emp_First_Name like @myParameter";
                cmd.Parameters.AddWithValue("@myParameter", '%' + prefixText + '%');


                cmd.CommandText = query1;
                cmd.ExecuteNonQuery();




                MySqlDataAdapter da = new MySqlDataAdapter(cmd);
                DataSet ds = new DataSet();
                da.Fill(ds);
                //return ds;


                DataTable dt = new DataTable();
                dt = ds.Tables[0];

                List<string> txtItems = new List<string>();
                String dbValues;
                foreach (DataRow row in dt.Rows)
                {
                    //String From DataBase(dbValues)
                    dbValues = row["Emp_First_Name"].ToString();
                    dbValues = dbValues.ToLower();
                    txtItems.Add(dbValues);
                }


                return txtItems;
          
            
        }  but list does not display.Please check where my code is wrong