- <script type="text/javascript">
- function Search_Gridview(strKey, strGV)
- {
- //debugger;
- //if (document.getElementById('ddlAppFor').value == "0") {
- //alert("hello");
- //}
- var strData = strKey.value.toLowerCase().split(" ");
- var tblData = document.getElementById(strGV);
- var rowData;
- for (var i = 1; i < tblData.rows.length; i++)
- {
- rowData = tblData.rows[i].innerHTML;
- var styleDisplay = 'none';
- for (var j = 0; j < strData.length; j++)
- {
- if (rowData.toLowerCase().indexOf(strData[j]) >= 0) styleDisplay = '';
- else
- {
- styleDisplay = 'none';
- break;
- }
- }
- tblData.rows[i].style.display = styleDisplay;
- }
- }
- </script>
On aspx page
- <asp:TextBox ID="txtSearch" runat="server" Font-Size="20px" placeholder="Find Application Data from Details"
- onkeyup="Search_Gridview(this, 'Grid_AppSearch')"></asp:TextBox><br />
- < asp: GridView ID = "Grid_AppSearch"
- runat = "server"
- Width = "100%"
- Style = "border: 0; height: auto;" >
- < /asp:GridView>
On Code Bihind
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using System.Data.SqlClient;
- using System.IO;
- public partial class class_name: System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- Bindyourgrid_in_pageload();
- }
- }
- }
