使用与自动填充文本框相同的技术填充中继器 [英] Populating repeater using the same technology as autocomplete for textboxes

查看:90
本文介绍了使用与自动填充文本框相同的技术填充中继器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我在表单上有一个文本框,并在数据库中存储了名字和姓氏,地址等,我想在中继器或数据网格上显示与文本框中键入的任何字符相匹配的人员的所有详细信息,无论其存储的电子邮件名是姓氏或电话号码...

请知道这可能很复杂,但是任何帮助都会非常有用,就像google搜索方式
但我希望它搜索单个表.

预先谢谢您.

Hi
I have a text box on a form and a database that stores first and last names, address, etc I wanna display on a repeater or datagrid all the details of the people who match any characters typed on the textbox whether its their stored email, Firstname lastname or telephone number...

Please I know it might be complex but any help will be really useful, just like how google searches
but i want it to search a single table.

Thank you in advance.

推荐答案

实际上并不难.您需要做的是返回在任何列中包含搜索字符串的所有行.

使用LINQ非常简单.

不幸的是,如果您自己编写SQL语句,那么如果名字包含搜索字符串,或者如果姓氏包含搜索字符串",这将是一个非常丑陋的混乱.

实际上,LINQ非常丑陋,但是IMO更加易于阅读.
It is actually not that difficult. What you are going to need to do is return all rows that CONTAIN the search string in any of the columns.

It is pretty simple to do with LINQ.

Unfortunately if you are writing the SQL statement yourself, it will be a pretty ugly mess of ''if firstname contains searchstring OR if lastname contains searchstring'' ect.

Actually, the LINQ is pretty close to as ugly, but IMO is a bit easier to read.


这篇关于使用与自动填充文本框相同的技术填充中继器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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