日期:2014-05-17 浏览次数:20451 次
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:AutoCompleteExtender ID="AutoCompleteExtender2" runat="server" TargetControlID="TextBox1" ServicePath="FindKeys.asmx" ServiceMethod="autoComplete">
</asp:AutoCompleteExtender>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
public class FindKeys : System.Web.Services.WebService
{
public FindKeys()
{ }
[WebMethod]
public String[] autoComplete(string prefix,int count)
{
//Datacon con = new Datacon();
//DataSet ds = new DataSet();
//ds = con.datasetbind("select DISTINCT KS_subject from tb_ShiTi where KS_subject like '%" + prefix
// + "%' ");
//string[] temp = new string[ds.Tables[0].Rows.Count];
//int i = 0;
//foreach (DataRow dr in ds.Tables[0].Rows)
//{
// temp[i] = dr["KS_subject"].ToString();
// i++;
//}
string[] temp=new string[3];
for(int i=1;i<5;i++)
{
temp[i]="aaa"+i ;
}
return temp;
}
}