<%@ Page Language="C#"
AutoEventWireup="true"
CodeFile="TestwebPage.aspx.cs"
Inherits="TestwebPage"
%>
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 runat="server">
<title>Untitled
Pagetitle>
<script type="text/javascript">
function
Filter(Obj)
{
var
grid=document.getElementById('GridView1');
var
terms = Obj.value;
var
cellNr = "0";//grid colunm cellindex in which you want to search
var
ele;
for (var r = 1; r < grid.rows.length; r++)
{
ele =
grid.rows[r].cells[cellNr].innerHTML.replace(/<[^>]+>/g, "");
if
(ele.toLowerCase().indexOf(terms) >= 0)
grid.rows[r].style.display = '';
else
grid.rows[r].style.display = 'none';
}
};
script>
head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" onkeyup="Filter(this);" />
<asp:GridView ID="GridView1" runat="server">
asp:GridView>
div>
form>
body>
html>
public partial class TestwebPage : System.Web.UI.Page
{
protected void Page_Load(object
sender, EventArgs e)
{
clsDashboard
objDB = new clsDashboard();
DataTable
dt1 = new DataTable();
string
sqlQryCity = string.Empty;
sqlQryCity = "select
Main_Node_Name from ea_treeview";
dt1 = objDB.getdatawithdt(sqlQryCity);
GridView1.DataSource = dt1;
GridView1.DataBind();
}
}