如何使搜索文本框像Google和youtube? [英] how make search textbox like google and youtube?

查看:142
本文介绍了如何使搜索文本框像Google和youtube?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

你好朋友,我想要搜索框,例如google和youtube,当我们在文本框中键入内容时会自动提示.

谁能指导我如何完成这项任务.

hello friend,

hello friend i want search box like google and youtube in which automatic suggestion comes out when we type in textbox.

can any one guide me how i can do this task.

推荐答案

您可以实现自动完成功能:
使用Jquery: http://jqueryui.com/demos/autocomplete/ [ http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx [ ^ ]
You can implement Auto complete feature:
Use Jquery : http://jqueryui.com/demos/autocomplete/[^]
OR Ajax Toolkit
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx[^]


您好亲爱的
您可以从TextBox的这些属性中使用
AutoCompleteCustomSource,
AutoCompleteMode,
AutoCompleteSource
如果您想拥有自定义来源,请执行以下操作
this.textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
您想要在文本框的历史记录中的每个字符串只需将其添加到文本框的AutoCompleteCustomSource
如果您需要VS的有关这些属性的帮助,请查看更多信息.
Hello Dear
you can use from these properties of TextBox
AutoCompleteCustomSource,
AutoCompleteMode,
AutoCompleteSource
if you want to have a custom source do these
this.textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
each string that you want to be in history of textbox just add it to AutoCompleteCustomSource of textbox
if you have a looking on help of VS about these properties you cab see more.


您可以使用AJAX来实现.

1)使用Web服务,该Web服务的Web方法将以从数据库查询的xml数据的形式返回.

2)在文本框的按键事件中,您将使用Java脚本调用Web服务.

3)使用Java脚本来填充列表框(如控件),方法是将XML数据解析为文本框下方的列表(如格式)格式.

有关更多详细信息,请参考 http://www.iansuttle.com/blog/post/Applying-AJAX-Using-ASPNET-11.aspx [ ^ ]
You can use AJAX to acheive this.

1) Use webservice and the webmethod of that webservice will return in form of xml data that is queried from database.

2) On keypress event of the textbox you will call the webservice using java script.

3) Use java script to fill the listbox like control by the xml data parsed in list like format just below the textbox.

For more details you can refer http://www.iansuttle.com/blog/post/Applying-AJAX-Using-ASPNET-11.aspx[^]


这篇关于如何使搜索文本框像Google和youtube?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆