VS2008中AutoCompleteExtender控件问题
我用AutoCompleteExtender控件做了一个测试,但是我在TEXTBOX中输入内容,在下拉列表中不能显示出来相关的内容.
下面我把两代码程序贴出来,大家指点一下.
页面
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<asp:TextBox ID="MyAuto" runat="server" Width="191px"></asp:TextBox><br />
<br />
<cc1:AutoCompleteExtender ID="ace" runat="server" CompletionInterval="100" MinimumPrefixLength="1"
ServiceMethod="GetCompultionList" ServicePath="WebService.asmx" TargetControlID="MyAuto">
</cc1:AutoCompleteExtender>
WebService.asmx代码中
[WebMethod]
public string[] GetCompultionList(string text,int count)
{
Random random = new Random();
List<string> items = new List<string>(count);
for (int i = 0; i < count; i++)
{
char c1=(char)random.Next(65,90);
char c2 = (char)random.Next(97,122);
char c3 = (char)random.Next(48, 57);
char c4 = (char)random.Next(33, 43);
items.Add(text + c1 + c2 + c3 + c4);
}
return items.ToArray();
}