【问题标题】:ASP.NET GridView with filtering in the column headers在列标题中过滤的 ASP.NET GridView
【发布时间】:2011-03-23 23:40:29
【问题描述】:

我需要使用允许在列标题中进行过滤的网格。我知道有一些第三方组件需要花钱。我正在寻找可以在项目中使用的免费/开源的东西。有人知道可以做到这一点的 GridView 吗?

【问题讨论】:

    标签: asp.net gridview datagrid


    【解决方案1】:

    一种方法是将下拉列表放在标题中,然后在 selectedchanged 事件上,根据它重新绑定您的网格。

    This article 是一个很好的示例。

    这个谷歌搜索很有帮助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

    【讨论】:

      【解决方案2】:

      我也需要一些跨列的过滤和排序,所以我环顾四周并将它们放在一起。 请参阅here 和此处。 它是动态的,标记看起来像这样,代码隐藏超过 1000 行 - 不确定我是否可以在这里发布。

       <%@ 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>
      

      【讨论】:

        猜你喜欢
        • 2012-01-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-03-27
        • 1970-01-01
        • 1970-01-01
        • 2014-11-17
        • 2019-12-25
        相关资源
        最近更新 更多