Hi,
 
Textbox wise search database data bind gridview using jquery datatable plugin but data bind with header also bind gridview,so avoid Header in gridview row
 
Jquery Script:
  1. <%--animated Zoom In--%>  
  2. <%--for gridview search,sort,paging--%>  
  3. "text/css" href="Design/css/dataTables.bootstrap.min.css" rel="stylesheet" />  
  4. "text/css" href="Design/css/responsive.bootstrap.min.css" rel="stylesheet" />  
  5.   
  6.   
  7.   
  8. <%--for gridview search,sort,paging--%>  
  9. "Design/bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet" />  
  10.   
  11.   
  12. "server" ID="txtCountry" />  
  13. "btnSearch" Text="Search" runat="server" />  

  14.   
  15. class
    ="table-responsive">  
  16. class
    ="table-wrapper">  
  17. "gvCustomers" CssClass="table table-striped table-bordered table-hover" runat="server" AutoGenerateColumns="false">  
  18.   
  19. "ContactName" HeaderText="Contact Name" />  
  20. "CustomerID" HeaderText="CustomerID" />  
  21. "City" HeaderText="City" />  
  22. "Country" HeaderText="Country" />  
  23.   
  24.   
  
  •   
  •   
  • Code:
    1. private void BindGridView()  
    2. {  
    3. string strConnString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;  
    4. using (SqlConnection con = new SqlConnection(strConnString))  
    5. {  
    6. SqlCommand cmd = new SqlCommand("SELECT ContactName,CustomerId,City,CompanyName [Country] FROM Customers", con);  
    7. using (SqlDataAdapter sda = new SqlDataAdapter(cmd))  
    8. {  
    9. using (DataSet ds = new DataSet())  
    10. {  
    11. sda.Fill(ds, "Customers");  
    12. gvCustomers.DataSource = ds;  
    13. gvCustomers.DataBind();  
    14. }  
    15. }  
    16. }  
    17. }  
    18. [System.Web.Services.WebMethod]  
    19. public static string GetCustomers(string searchTerm)  
    20. {  
    21. DataSet ds = new DataSet();  
    22. string strConnString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;  
    23. SqlConnection con = new SqlConnection(strConnString);  
    24. string query = "SELECT ContactName,CustomerId,City, CompanyName [Country] FROM Customers";  
    25. if (!string.IsNullOrEmpty(searchTerm))  
    26. {  
    27. query += " WHERE CompanyName LIKE '" + searchTerm + "%'";  
    28. }  
    29. SqlCommand cmd = new SqlCommand(query, con);  
    30. cmd.CommandType = CommandType.Text;  
    31. SqlDataAdapter sda = new SqlDataAdapter(cmd);  
    32. sda.Fill(ds, "Customers");  
    33. return ds.GetXml();  
    34. }