Click here to Skip to main content
15,942,545 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I am using below web method for auto complete extender, but it is not working ?
C#
public List<string> GetBySuburb(string txtPrefix)
       {
           List<string> objListSuburb = new List<string>();
           Initialize(StoredProcedure.GETBYSTATE);
           DataBase.AddInParameter(DbCommand, Parameters.BUILDSUBURB, DbType.String, txtPrefix);
           using (IDataReader objDataReader = DataBase.ExecuteReader(DbCommand))
           {
               while (objDataReader.Read())
               {
                   objListSuburb.Add(objDataReader[Parameters.BUILDSUBURB].ToString());
               }
           }
           return objListSuburb;
       }
Posted
Updated 6-May-11 0:20am
v2

1 solution

That's because AjaxControlToolkit expects the method to be in the following format:

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] GetCompletionList(string prefixText, int count);


Change your method this way, and do something w/ "count" if you need it

public string[] GetCompletionList(string prefixText, int count)
       {
           List<string> objListSuburb = new List<string>();
           Initialize(StoredProcedure.GETBYSTATE);
           DataBase.AddInParameter(DbCommand, Parameters.BUILDSUBURB, DbType.String, prefixText);
           using (IDataReader objDataReader = DataBase.ExecuteReader(DbCommand))
           {
               while (objDataReader.Read())
               {
                   objListSuburb.Add(objDataReader[Parameters.BUILDSUBURB].ToString());
               }
           }
           return objListSuburb.ToArray();
       }
 
Share this answer
 
v4
Comments
Karthik. A 6-May-11 16:18pm    
I presume you are referring to the auto complete extender from ajax control toolkit...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900