AutoCompleteExtender不适用于asp吗?

时间:2013-11-20 13:38:51

标签: c# asp.net asp.net-ajax

我想在我的项目中使用此页面添加一个AutoCompleExtender:

     <asp:TextBox ID="txtMovie" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtautofromDB" runat="server" autocomplete="off"></asp:TextBox>
        <asp:AutoCompleteExtender ServiceMethod="GetCompletionList2" 
MinimumPrefixLength="2"
CompletionInterval="100" EnableCaching="true" CompletionSetCount="10" 
TargetControlID="txtMovie"
ID="AutoCompleteExtender1" runat="server" FirstRowSelected = "false" />

和服务器代码是:

[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public static string[] GetCompletionList2(string prefixText, int count)
{
    dt = Telephone.Search(prefixText);
    List<string> CountryNames = new List<string>();

    foreach(DataRow dr in dt.Rows)
    {
        CountryNames.Add(dr[0].ToString());

    }
    return CountryNames.ToArray();
}

但它不起作用。

0 个答案:

没有答案