我怎么能突出GridView控件中的一个词 [英] How can I highlight a word within gridview
本文介绍了我怎么能突出GridView控件中的一个词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何能突出一个查询的GridView控件中文字?
How can I highlight the text of a query in the gridview control?
推荐答案
如果你想这样做客户端,请按照此步骤进行:
if you want do this client side please follow this steps:
添加jQuery的引用您的page.add文本输入卡列斯 txt_Search
。
add jQuery reference to your page.add a text input calles txt_Search
.
,然后使用这个脚本:
$(document).ready(function () {
$('#txt_Search').keyup(function () {
searchTable($(this).val());
});
function searchTable(inputVal) {
var table = $('#GridView1');
table.find('tr').each(function (index, row) {
var allCells = $(row).find('td');
if (allCells.length > 0) {
var found = false;
allCells.each(
function (index, td) {
var regExp = new RegExp(inputVal, 'i');
if (regExp.test($(td).text())) {
found = true;
return false;
}});
if (found == true) $(row).show(); else $(row).hide();
}
});
}
});
这篇关于我怎么能突出GridView控件中的一个词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文