开发者

ASP.NET GridView with filtering in the column headers

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?


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


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜