如何使用jquery检查数据集中的重复值 [英] How to check duplicate value in dataset using jquery
本文介绍了如何使用jquery检查数据集中的重复值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有三列数据集
代码desc价格
黑色abc 20.00
白色cbd 25.50
blue mnb 30.00
我想检查aspx表单按钮上的文本框重复记录在数据集中使用jquery并在数据集中存在重复值时显示警告。
我如何才能完成此任务
请帮帮我
提前感谢
I have a dataset in with three columns
code desc price
black abc 20.00
white cbd 25.50
blue mnb 30.00
I want check duplicate record of textbox on button click of aspx form in dataset using jquery and display an alert if duplicate value exist in dataset.
how can i achieve this task
please help me
thanks in advance
推荐答案
同意Kornfeld。在服务器端或客户端执行此操作。不要混合东西。我给你样品,定制它。
服务器端 - 使用数据行数组检查现有记录 [ ^ ]
客户端 - JQUERY:在表格中标记具有相同值的行 [ ^ ]
使用jQuery搜索表行 [ ^ ]
Agree with Kornfeld. Do it either on server side or client side. Don't mix things. I give you samples, customize it.
Server side - Checking Existing Records Using Array of Data Rows[^]
Client side - JQUERY: Mark rows with identical values in a table[^]
Searching table rows with jQuery[^]
我假设
D. uplicate表示整行与整行匹配,不仅仅是单元格
您希望在填充所有行后显示消息,而不是在每行之后显示消息
我建议在javascript中使用以下内容
1.对于每一行,将3个单元格的值连接成一个字符串
2.将所有这些字符串合并为一个字符串数组
3.使用像这样的代码 [ ^ ]查找重复的条目并突出显示屏幕上的这些行。您还可以在JS中找到许多其他此类代码snipets以找出重复的条目。
[请鼓励参与,接受/投票给你的答案或解决方案]
I am assuming
Duplicate means the entire row matches with an entire row, not only cells
You want to show the message after all the rows are filled, not after each row
I would suggest the following in javascript
1. For each row concatenate values of the 3 cells into one string
2. Get all these strings into one string array
3. Use code like this[^] to find out the duplicate entries and highlight those rows on your screen. You can also find many other such code snipets in JS to find out duplicate entries.
[Please encourage participation by accepting/up-voting answers or solutions that work for you]
这篇关于如何使用jquery检查数据集中的重复值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文