try this
<pre lang="xml">[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static List<string> GetCategory(string prefixText)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connection"].ToString());
con.Open();
SqlCommand cmd = new SqlCommand("select distinct product from ProductAdd where product like @Name+'%'", con);
cmd.Parameters.AddWithValue("@Name", prefixText);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
List<string> Cid = new List<string>();
for (int i = 0; i < dt.Rows.Count; i++)
{
Cid.Add(dt.Rows[i]["product"].ToString());
}
return Cid;
}
u want to call this method in client side in AutoCompleteExtender as ServiceMethod="GetCategory"
i hope this use full for you...