asp.net - 当 '*' 字符存在时禁用 AutoCompleteExtender

标签 asp.net ajaxcontroltoolkit

我有一个问题。

我正在为我的文本框使用 AutoCompleteExtender。显示所有自动完成单词。但我需要下一个行为:当文本框中存在“*”字符时,不得显示自动完成单词。

我该怎么做?

最佳答案

在您的 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
}

关于asp.net - 当 '*' 字符存在时禁用 AutoCompleteExtender,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1192931/

相关文章:

c# - 捕捉所有 *.aspx 请求的 ASP.Net MVC 路由

asp.net - AjaxPro 无法在 .Net Framework 4.0 和 Server 2008/IIS 7 上运行

asp.net - 为什么下载的文件无法保留在模型弹出窗口中?

javascript - jquery 与 ajax 控制工具包 2013 年 9 月/10 月版本冲突

asp.net - 处理 Null 条件

c# - 使用 WCF、Windows Phone 7 和 ASP.Net

asp.net - 如何设置 HtmlEditorExtender 的内容服务器端

asp.net - HTMLEditorExtender 在异步回发时对 img 标签进行编码

c# - 生成 MSDN 文档 URL

asp.net - ASP.NET MVC 应用程序的性能和安全性 - 处理程序映射和模块