前台界面:
代码
<asp:textbox id="TextBox1" runat="server"></asp:textbox>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender3" runat="server" Enabled="true"
TargetControlID="TextBox1"
ServicePath="/LsComplete.asmx"
ServiceMethod="GetCompleteDepart"
CompletionInterval="500"
CompletionSetCount="10"
MinimumPrefixLength="1">
</ajaxToolkit:AutoCompleteExtender>
后台代码:
新建一个web服务:
代码
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
/// <summary>
/// LsComplete 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class LsComplete : System.Web.Services.WebService {
public LsComplete () {
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}