Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 是否可以将DataTables列筛选器加载项与gridview一起使用。_C#_Jquery_Asp.net_Datatables - Fatal编程技术网

C# 是否可以将DataTables列筛选器加载项与gridview一起使用。

C# 是否可以将DataTables列筛选器加载项与gridview一起使用。,c#,jquery,asp.net,datatables,C#,Jquery,Asp.net,Datatables,我试图在预渲染期间为定义tfoot部分和表行。有没有一种方法可以使用DataTables列筛选器加载项定义文本输入,但我无法生成tfoot表行。我错过了什么 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Home { public par

我试图在预渲染期间为定义tfoot部分和表行。有没有一种方法可以使用DataTables列筛选器加载项定义文本输入,但我无法生成tfoot表行。我错过了什么

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Home
{
    public partial class Glossary : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GridView1.PreRender += new EventHandler(GridView1_PreRender);
        }
        protected void GridView1_PreRender(object sender, EventArgs e)
        {
           if (GridView1.Rows.Count > 0)
           {
             //forces grid to render thead/th elements 
             GridView1.UseAccessibleHeader = true; 
             GridView1.HeaderRow.TableSection = TableRowSection.TableHeader;
             GridView1.FooterRow.TableSection = TableRowSection.TableFooter;
           }
}
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
}
}
这是当前表单的代码。我想知道是不是出了什么问题

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Glossary.aspx.cs" Inherits="Home.Glossary" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title spellcheck="true">Glossary</title>
    <style type="text/css" media="all">
        @import "DataTables-1.9.4/DataTables-1.9.4/media/css/jquery.dataTables_themeroller.css";
        #form1 {
            width: 100%;
        }
    </style>        
    <script src="JQuery-DataTables-ColumnFilter/media/js/jquery.dataTables.columnFilter.js"></script>
        <script src="DataTables-1.9.4/DataTables-1.9.4/media/js/jquery.js"></script>
        <script src="DataTables-1.9.4/DataTables-1.9.4/media/js/jquery.dataTables.js"></script>


        <script>

            $(document).ready(function () {
                $('#<%=GridView1.ClientID%>').dataTable()
                     .columnFilter();
            });
        </script>
    </head>
<body>
    <form id="form1" runat="server">

    <div style="background: #A0A0A0">

        <asp:LoginView ID="LoginView1" runat="server">
            <AnonymousTemplate>
                <asp:Login ID="Login1" runat="server" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPadding="4" BorderStyle="None" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333" Height="111px" Width="213px" style="margin-left: 0px; margin-right: 4px;">
                    <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
                    <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />
                    <TextBoxStyle Font-Size="0.8em" />
                    <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
                </asp:Login>
            </AnonymousTemplate>
        </asp:LoginView>

        </div>

        <asp:SqlDataSource ID="TedGlossary" runat="server" ConnectionString="<%$ ConnectionStrings:Glsry_Taylor %>" SelectCommand="SELECT * FROM [Glossary] ORDER BY [TermText]"></asp:SqlDataSource>

        <asp:GridView ID="GridView1" runat="server" DataKeyNames="TermText,DefNbr,DefVerNbr" DataSourceID="TedGlossary" 
            EnableSortingAndPagingCallbacks="True" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
             AutoGenerateColumns="False" AutoGenerateEditButton="False" style="margin-right: 0px" Width="100%" Height="332px">               




            <Columns>
                <asp:BoundField DataField="TermText" HeaderText="Term" ReadOnly="True" SortExpression="Term" />
                <asp:BoundField DataField="DefNbr" HeaderText="Number" ReadOnly="True" SortExpression="DefinitionNumber" />
                <asp:BoundField DataField="DefVerNbr" HeaderText="Version" ReadOnly="True" SortExpression="DefinitinonVersionNumber" />
                <asp:BoundField DataField="DefText" HeaderText="Definition" SortExpression="Definition" />
                <asp:BoundField DataField="AmplifyingExplanationText" HeaderText="Amplifying Explanation" SortExpression="AmplifyingExplanationText" />
                <asp:BoundField DataField="SeeAlsoText" HeaderText="See Also" SortExpression="See Also" />
                <asp:BoundField DataField="AuthoritativeSrcText" HeaderText="Authoritative Source" SortExpression="AuthoritativeSrcText" />
                <asp:BoundField DataField="ScopeName" HeaderText="Scope" SortExpression="Scope" />
                <asp:BoundField DataField="DomnName" HeaderText="Domain" SortExpression="Domain" />
                <asp:BoundField DataField="GovernanceStateName" HeaderText="Governance State" SortExpression="GovernanceStateName" />
                <asp:BoundField DataField="LastUpdtTimestamp" HeaderText="Last Updated" SortExpression="LastUpdtTimestamp" />
            </Columns>



            <FooterStyle BackColor="Silver" />



        </asp:GridView>


    </form>


</body>

</html>

词汇表
@导入“DataTables-1.9.4/DataTables-1.9.4/media/css/jquery.DataTables\u themeroller.css”;
#表格1{
宽度:100%;
}
$(文档).ready(函数(){
$('#')。数据表()
.columnFilter();
});

您需要将Gridview的属性“ShowFooter”设置为True。默认设置为False

<asp:GridView ID="GridView1" runat="server" ShowFooter="True" />     


@empture\u dev una consulta como puscado el buscador en footer yo colocado pero los buscadores no me salen ayudame hermano.@empture\u dev me sale un error console var table=$('GridView1').DataTable().columnFilter();