Hi @RAVI,
You can modify to the code below.
JavaScript String indexOf():returns the position of the first occurrence of a value in a string.As long as rowData.toLowerCase() contains strData[j], the judgment of rowData.toLowerCase().indexOf(strData[j]) >= 0 is established.
It can directly match the data of the gridview column (cell[i], i starts from 0. So i is 1 in my example).
<script type="text/javascript">
function Search_Gridview(strKey) {
var strData = strKey.value.toLowerCase();
var tblData = document.getElementById("<%=GridView1.ClientID %>");
var rowData;
for (var i = 1; i < tblData.rows.length; i++) {
rowData = tblData.rows[i].cells[1].innerHTML;
rowData = rowData.toLowerCase();
var styleDisplay = 'none';
if (rowData == strData)
styleDisplay = '';
else {
styleDisplay = 'none';
}
tblData.rows[i].style.display = styleDisplay;
}
}
</script>
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.