当'*'字符存在时禁用AutoCompleteExtender

2 asp.net ajaxcontroltoolkit

我有个问题.

我正在使用AutoCompleteExtender作为我的文本框.所有自动填充单词显示.但我需要下一个行为:当文本框中有'*'字符时,不得显示自动填充单词.

我怎样才能做到这一点?

Zha*_*uid 5

在您的ServiceMethod中,您可以检查字符串是否存在通配符,而不是返回任何结果?

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] GetCompletionList(string prefixText, int count) {
  string[] results = null;
  if (string.IndexOf("*") == -1) {
    // Retrieve your autocomplete options here.
    // Create a new string[] and add the options.
  }
  return results
}
Run Code Online (Sandbox Code Playgroud)