filter not working in gridview

RAVI 936 Reputation points
2022-10-15T06:44:21.053+00:00

Hello

This Is My Gridview It Load Fine When I Select Filter It disapper Please Help me to solve this

aspx code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>  
   
<html xmlns="http://www.w3.org/1999/xhtml" >  
<head runat="server">  
    <title>Untitled Page</title>  
          
  <script type="text/javascript" src="jquery-3.2.1.min.js"></script>     
<link rel="stylesheet" href="bootstrap.min.css" />  
 <script src="excel-bootstrap-table-filter-bundle.js"></script>  
   
<link rel="stylesheet" href="excel-bootstrap-table-filter-style.css">  
   
  <script>  
    // Use the plugin once the DOM has been loaded.  
    $(function () {  
      // Apply the plugin   
      $('#div').excelTableFilter();  
   
    });  
  </script>  
   
</head>  
<body>  
    <form id="form1" runat="server">  
      <div>  
          
        <div id="div">  
<asp:GridView ID="gvDemo" runat="server" AutoGenerateColumns="false">  
    <Columns>  
        <asp:BoundField DataField="Item1" HeaderText="Item1" />  
        <asp:BoundField DataField="Qty" HeaderText="Qty" />  
          <asp:BoundField DataField="Description" HeaderText="Description" />  
          
    </Columns>  
</asp:GridView>  
</div>  
   
          
      
    </div>  
    </form>  
</body>  
</html>  

C# code

using System;  
using System.Data;  
using System.Configuration;  
using System.Collections;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Data.SqlClient;  
using System.Collections.Specialized;  
using System.Text;  
using System.Drawing;  
using System.IO;  
using System.Net;  
using System.Net.Mail;  
using System.Net.Configuration;  
  
public partial class _Default : System.Web.UI.Page  
{  
  
  
      
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!Page.IsPostBack)  
        {  
            DataTable dt = new DataTable();  
            dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Item1", typeof(string)),      
                    new DataColumn("Qty", typeof(int)),      
                    new DataColumn("Description",typeof(string)) });  
            dt.Rows.Add("Flour", "10", "D1");  
            dt.Rows.Add("Tea", "20", "55");  
            dt.Rows.Add("Rice", "66", "F2");  
            gvDemo.DataSource = dt;  
            gvDemo.DataBind();     
              
        }  
    }  
    protected void btnPopulate_Click(object sender, EventArgs e)  
    {  
  
    }  
}  

Thanking You

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,315 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Lan Huang-MSFT 26,521 Reputation points Microsoft Vendor
    2022-10-17T06:03:10.067+00:00

    Hi @RAVI ,
    Filter not working in gridview should be that your excel-bootstrap-table-filter-bundle.js is not used.
    Do you have the correct download of this third party library? You can check this link: https://github.com/chestercharles/excel-bootstrap-table-filter
    Or you can use the link directly:

    <scr ipt sr c="https://www.jqueryscript.net/demo/Excel-like-Bootstrap-Table-Sorting-Filtering-Plugin/excel-bootstrap-table-filter-bundle.js"></sc ript>  
    <li nk r el="style sh eet" hr ef="https://www.jqueryscript.net/demo/Excel-like-Bootstrap-Table-Sorting-Filtering-Plugin/excel-bootstrap-table-filter-style.css"/>  
    

    250945-image.png
    250915-1.gif
    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.


  2. RAVI 936 Reputation points
    2022-10-20T08:27:31.867+00:00

    Hello

    any Other script for free same like excel multi filter please refer in jquery for asp.net gridview column filters without postback.

    Thaning You

    0 comments No comments

  3. RAVI 936 Reputation points
    2022-10-26T07:09:50.387+00:00

    Hello @ LanHuang-MSFT

    any Other script for free same like excel multi filter please refer in jquery for asp.net gridview column filters without postback.

    Thaning You

    0 comments No comments