提供“键入时搜索”的最佳方式是什么?

时间:2022-09-13 09:23:18

I'm porting a Forms app to a VB.NET web app, and one of the feature the users really liked was the ability to narrow the possible choices as the user typed in a search box. The search itself goes against multiple tables and columns (and takes several seconds), so it's not a simple AutoComplete or anything. What's the best way to allow the user to type, and asynchronously update a ListView with the matches?

我正在将一个Forms应用程序移植到VB.NET Web应用程序中,用户真正喜欢的功能之一是能够在用户在搜索框中键入时缩小可能的选择范围。搜索本身违反了多个表和列(并且需要几秒钟),所以它不是简单的自动完成或任何东西。允许用户使用匹配键入和异步更新ListView的最佳方法是什么?

3 个解决方案

#1


1  

JQuery will be a good solution to filter the ListView at client side. Check this recent article and another cool demo here

JQuery将是一个很好的解决方案,可以在客户端过滤ListView。查看这篇最近的文章和另一个很酷的演示

#2


1  

You should be able to use the Dynamic Populate control in the AJAX Control Toolkit to do most of the legwork.

您应该能够使用AJAX Control Toolkit中的Dynamic Populate控件来完成大部分工作。

#3


0  

Check out the ASP.NET AJAX controls. There is a specific control for autocompletion:

查看ASP.NET AJAX控件。自动完成有一个特定的控件:

AutoComplete is an ASP.NET AJAX extender that can be attached to any TextBox control, and will associate that control with a popup panel to display words that begin with the prefix typed into the textbox.

AutoComplete是一个ASP.NET AJAX扩展程序,可以附加到任何TextBox控件,并将该控件与弹出面板关联,以显示以在文本框中键入的前缀开头的单词。

The dropdown with candidate words supplied by a web service is positioned on the bottom left of the text box.

Web服务提供的候选词的下拉列表位于文本框的左下角。

In the sample above, the textbox is associated with an AutoCompleteExtender that pulls words that start with the contents of the textbox using a web service.

在上面的示例中,文本框与AutoCompleteExtender相关联,AutoCompleteExtender使用Web服务提取以文本框内容开头的单词。

When you have typed more content than the specified minimum word length, a popup will show words or phrases starting with that value. Caching is turned on, so typing the same prefix multiple times results in only one call to the web service.

当您输入的内容多于指定的最小字长时,弹出窗口将显示以该值开头的单词或短语。启用了缓存,因此多次键入相同的前缀只会导致对Web服务的一次调用。

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx

There is also a control for searching lists, as you described.

如您所述,还有一个用于搜索列表的控件。

#1


1  

JQuery will be a good solution to filter the ListView at client side. Check this recent article and another cool demo here

JQuery将是一个很好的解决方案,可以在客户端过滤ListView。查看这篇最近的文章和另一个很酷的演示

#2


1  

You should be able to use the Dynamic Populate control in the AJAX Control Toolkit to do most of the legwork.

您应该能够使用AJAX Control Toolkit中的Dynamic Populate控件来完成大部分工作。

#3


0  

Check out the ASP.NET AJAX controls. There is a specific control for autocompletion:

查看ASP.NET AJAX控件。自动完成有一个特定的控件:

AutoComplete is an ASP.NET AJAX extender that can be attached to any TextBox control, and will associate that control with a popup panel to display words that begin with the prefix typed into the textbox.

AutoComplete是一个ASP.NET AJAX扩展程序,可以附加到任何TextBox控件,并将该控件与弹出面板关联,以显示以在文本框中键入的前缀开头的单词。

The dropdown with candidate words supplied by a web service is positioned on the bottom left of the text box.

Web服务提供的候选词的下拉列表位于文本框的左下角。

In the sample above, the textbox is associated with an AutoCompleteExtender that pulls words that start with the contents of the textbox using a web service.

在上面的示例中,文本框与AutoCompleteExtender相关联,AutoCompleteExtender使用Web服务提取以文本框内容开头的单词。

When you have typed more content than the specified minimum word length, a popup will show words or phrases starting with that value. Caching is turned on, so typing the same prefix multiple times results in only one call to the web service.

当您输入的内容多于指定的最小字长时,弹出窗口将显示以该值开头的单词或短语。启用了缓存,因此多次键入相同的前缀只会导致对Web服务的一次调用。

http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx

There is also a control for searching lists, as you described.

如您所述,还有一个用于搜索列表的控件。