我有一个带有 Ajax AutoComplete Extender 的 ASP.NET 应用程序,它工作正常,但我只想在列表中看到 10 到 15 个元素。我该怎么做?
aspx:
<asp:TextBox ID="txtVertreter" runat="server"></asp:TextBox>
<asp:AutoCompleteExtender ID="AutoComlete" runat="server" TargetControlID="txtVertreter"
ServiceMethod="GetCompletionList" ServicePath="" Enabled="true"
DelimiterCharacters="" UseContextKey="true" MinimumPrefixLength="1" ></asp:AutoCompleteExtender>
我的cs代码:
[System.Web.Script.Services.ScriptMethod]
[System.Web.Services.WebMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
ArrayList filteredList = new ArrayList();
string s2 = "\n";
char[] ch = s2.ToCharArray();
UserService srv = new UserService();
ArrayList AList = srv.VertreterFinden(Domain, prefixText);
string[] names = AList.ToArray(typeof(string)) as string[];
foreach (string name in names)
{
if
(name.ToLower().StartsWith(prefixText.ToLower()))
{
filteredList.Add(name);
}
} return (string[])
filteredList.ToArray(typeof(string));
}