view sourcePRint?1 <script type="text/javascript">
2 $(function() {
3 $("#Text1").keyup(function() {
4 var filterText = $(this).val();
5 $("#<%=GridView1.ClientID %> tr").not(":first").hide().filter(":contains('" + filterText + "')").show(); ;
6 }).keyup();
7 });
8 </script>
illustrate:
The most important thing is the JQuery selector:
1: $("#<%=GridView1.ClientID %> tr") selects all rows of the table;
2: not(":first"): Remove the first header row;
3: filter(":contains('" + filterText + "')"): Filter out the lines containing filterText in the line text selected above and display them;
4: The last keyup() sentence is added to re-trigger the keyup event after submission. (But it has no effect here because the client control I use does not have ViewState.
If it is a server-side control, you will see its effect).