CreateAutoCompleteItem method is not defined in AutoCompleteExtender issue

Feb 4 2010 2:26 AM
Hi,

I am using AutoCompleteExtender control of AjaxControlToolkit for ASP.NET 2.0 on my aspx page. 

This control is working fine and i am receiving values from database but the problem is that I am unable to get the key for selects value in the control. I heard that CompleteAutoCompletionItem(key,value) method can provide keys and value to the control.

When I use this code:

AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(key,value)

I get an error stating "AjaxControlToolkit.AutoCompleteExtender does not contain a definition for 'CreateAutoCompletionItem'"

Code for my web service is :

using System;
using System.Collections.Generic;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
public AutoComplete()
{
}
[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
string str = // sql connection string
SqlConnection conn = new SqlConnection(str);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = conn;
cmd.CommandText = "Ajax_GetCustomerList";
cmd.Parameters.Add("@customerNameSubString", SqlDbType.VarChar,100).Value = prefixText.ToString();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "customerSubStringList");
string[]chk = new string[ds.Tables[0].Rows.Count];
int i = 0;

ArrayList list = new ArrayList();

foreach (DataRow dr in ds.Tables[0].Rows)
{
chk[i] = dr[0].ToString();
i++;

//list.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(dr[1].ToString(),dr[0].ToString())); /* This line I added to get the key, value pair */

}
return chk;
}

}

Any help will be appreciated. Thanks in advance !

Regards,
Divya