jQuery autocomplete in ASP.NET webforms?(ASP.NET webforms 中的 jQuery 自动完成?)
问题描述
有没有人使用 jQuery 在使用 ASP.NET webforms 的文本框上填充自动完成列表?如果是这样,任何人都可以推荐一个好的方法吗?从我到目前为止的阅读来看,似乎大多数人都在使用分隔列表而不是 JSON 来恢复项目.我愿意接受任何能让我快速上手的想法.
网上有很多很多的例子.我以前用过这个,如果我记得你只需要创建一个 aspx,它将以 <BR/>
分隔列表的形式返回匹配的术语:
http://www.dyve.net/jquery/?autocomplete>
文档在示例中显示了 php,但插件本身的工作方式没有区别,因此我不必做任何特别的事情.
来自文档:
>$("#input_box").autocomplete("my_autocomplete_backend.php");
<块引用>
在上面的例子中,自动完成需要一个带有 id 的输入元素输入框"存在.当一个用户开始在输入框中输入,自动完成程序将请求带有 GET 的 my_autocomplete_backend.php名为 q 的参数包含输入框的当前值.让我们假设用户已经输入foo"(不带引号).自动完成然后会要求my_autocomplete_backend.php?q=foo.
后端应该可以输出自动完成程序的值,每个单行.输出不能包含管道符号|",因为那是被认为是一个分隔符(更多关于那个稍后).
一个合适的简单输出是:富傻子脚松垮垮的富战士食物大战
Has anyone used jQuery to populate an autocomplete list on a textbox using ASP.NET webforms? If so, can anyone recommend a good method? From my reading so far, it seems like most people are using delimited lists rather than JSON to bring the items back. I'm open to any ideas that will get me up and running rather quickly.
There are many, many examples on the web. I've used this one before, and if I recall you only need to create an aspx that will return matching terms as a <BR/>
separated list:
http://www.dyve.net/jquery/?autocomplete
The documentation shows php in the example, but there's no difference in the way the plugin itself works and I didn't have to do anything special as a result.
From the documentation:
> $("#input_box").autocomplete("my_autocomplete_backend.php");
In the above example, Autocomplete expects an input element with the id "input_box" to exist. When a user starts typing in the input box, the autocompleter will request my_autocomplete_backend.php with a GET parameter named q that contains the current value of the input box. Let's assume that the user has typed "foo"(without quotes). Autocomplete will then request my_autocomplete_backend.php?q=foo.
The backend should output possible values for the autocompleter, each on a single line. Output cannot contain the pipe symbol "|", since that is considered a separator (more on that later).
An appropiate simple output would be: foo fool foot footloose foo fighters food fight
这篇关于ASP.NET webforms 中的 jQuery 自动完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:ASP.NET webforms 中的 jQuery 自动完成?


- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 输入按键事件处理程序 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01