第一步,放置控件,并设置属性如下: <asp:TextBox ID="txtCity" runat="server"></asp:TextBox> <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtCity" ServicePath="WebService.asmx" ServiceMethod="GetTextString" CompletionSetCount="5" MinimumPrefixLength="1" CompletionInterval="500"> </cc1:AutoCompleteExtender> 第二步,在WebService中增加提供数据的方法: /// <summary> /// Summary description for WebService /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(true)] [System.Web.Script.Services.ScriptService] public class WebService : System.Web.Services.WebService { [WebMethod] public string[] GetTextString(string prefixText, int count) { DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(int)); dt.Columns.Add("Name1", typeof(string)); dt.Columns.Add("Name2", typeof(string)); dt.Columns.Add("Name3", typeof(string)); dt.Columns.Add("Name4", typeof(string)); DataRow dr1 = dt.NewRow(); dr1["ID"] = 1; dr1["Name1"] = "上海"; dr1["Name2"] = "sh"; dr1["Name3"] = "shanghai"; dr1["Name4"] = ""; dt.Rows.Add(dr1); DataRow dr2 = dt.NewRow(); dr2["ID"] = 2; dr2["Name1"] = "深圳"; dr2["Name2"] = "sz"; dr2["Name3"] = "shenzhen"; dr2["Name4"] = ""; dt.Rows.Add(dr2); DataRow dr3 = dt.NewRow(); dr3["ID"] = 3; dr3["Name1"] = "北京"; dr3["Name2"] = "bj"; dr3["Name3"] = "beijing"; dr3["Name4"] = ""; dt.Rows.Add(dr3); DataRow dr4 = dt.NewRow(); dr4["ID"] = 4; dr4["Name1"] = "成都"; dr4["Name2"] = "cd"; dr4["Name3"] = "chengdu"; dr4["Name4"] = ""; dt.Rows.Add(dr4); DataRow dr5 = dt.NewRow(); dr5["ID"] = 5; dr5["Name1"] = "西安"; dr5["Name2"] = "xa"; dr5["Name3"] = "xi'an"; dr5["Name4"] = "xian"; dt.Rows.Add(dr5); string strWhere = "Name1 like '" + prefixText + "%' or Name2 like '" + prefixText + "%' or Name3 like '" + prefixText + "%' or Name4 like '" + prefixText + "%'"; DataRow[] drs = dt.Select(strWhere, "ID"); int total = drs.Length > count ? count : drs.Length; string[] strArray = new string[total]; for (int i = 0; i < total; i++) { strArray[i] = drs[i]["Name1"].ToString() + " " + drs[i]["Name3"].ToString(); } return strArray; } } OK,you can see: