<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowGridviewContent.aspx.cs" Inherits="ShowGridviewContent" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title></title>
<style type="text/css">
.hightlite
{
background-color:Gray;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("#searchBtn").click(function () {
var search = $("#SearchWord").val();
var row = $('#grdEmployees >tbody >tr');
var rowcolumn = $('#grdEmployees >tbody >tr >td');
row.removeClass('hightlite');
rowcolumn.each(function (column) {
var match = $(this).html();
if (match == search) {
$(this).parent().addClass('hightlite');
}
});
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" id="SearchWord" /><input type="button" id="searchBtn" value="快速定位行" />
<asp:GridView ID="grdEmployees" runat="server" AllowPaging="true" PageSize="10"
AutoGenerateColumns="false" DataSourceID=&#
Jquery根据关键字快速定位GridView指定行,用于数据快速检索
最新推荐文章于 2020-11-21 10:39:44 发布