I need to use a grid that allows for filtering in the column headers. I know there are some third-party components out there that cost money. I am looking for something that is free / open-source that can be used on a project. Is anyone aware of a GridView that can do this?
+1
A:
One way is to put drop down lists in the headers and on the selectedchanged event, rebind your grid based on that.
This article is a good sample.
This google search is helpful http://www.google.com/search?q=asp.net+gridview+header+filter&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
TheGeekYouNeed
2010-08-02 01:50:35
+1
A:
I too needed some filtering and sorting across columns, so I looked around and put this together. See here and here. It's dynamic and the markup looks like this, the codebehind is 1000+ rows -not sure if I can post it here.
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" EnableViewState="True"%>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<link href="AdminCSS.css" rel="stylesheet" type="text/css" />
<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="True">
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" AutoPostBack="True">
<asp:ListItem Value="BASE TABLE">Only tables</asp:ListItem>
<asp:ListItem Value="VIEW">Only Views</asp:ListItem>
<asp:ListItem Selected="True" Value="%">Tables and Views</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl3" runat="server" AutoPostBack="True">
<asp:ListItem>SELECT TOP 1</asp:ListItem>
<asp:ListItem Selected="True">SELECT TOP 50</asp:ListItem>
<asp:ListItem>SELECT TOP 200</asp:ListItem>
<asp:ListItem>SELECT TOP 1000</asp:ListItem>
<asp:ListItem>SELECT TOP 5000</asp:ListItem>
<asp:ListItem>SELECT</asp:ListItem>
</asp:DropDownList>
<asp:CheckBox ID="chkSideways" AutoPostBack="true" Text="Show Tabs Sideways" runat="server">
</asp:CheckBox>
<asp:Label ID="lblTbleCount" runat="server" Text="" Style="margin-left: 30px"></asp:Label>
</asp:Content>
Freewheelin
2010-08-04 12:43:18