check this
Search GridView records (data) on Column TextBox KeyPress using jQuery in ASP.Net[
^]
or try this
ASPX/HTML
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
Column1
<br />
<input type="text" id="Column1" onkeyup="searchTable(this,0)" />
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Column1") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Column2<br />
<input type="text" id="Column2" onkeyup="searchTable(this,1)" />
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Column2") %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Column3<br />
<input type="text" id="Column3" onkeyup="searchTable(this,2)" />
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "Column3") %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Javascript
function searchTable(obj, index) {
var filter = obj.value.toUpperCase();
var grid = document.getElementById('<%= gv.ClientID%>');
for (var i = 1; i < grid.rows.length; i++)
grid.rows[i].style.display = grid.rows[i].cells[index].innerText.toUpperCase().indexOf(filter) > -1 ? '' : 'none';
}
Code Behind c#
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add("Column1");
dt.Columns.Add("Column2");
dt.Columns.Add("Column3");
dt.Rows.Add("apple", "ant", "animal");
dt.Rows.Add("bat", "ball", "bull");
dt.Rows.Add("cat", "call", "con");
dt.Rows.Add("dog", "doll", "dice");
gv.DataSource = dt;
gv.DataBind();
}
}