问题将jquery数据表实现到gridview [英] Problem Implementing jquery datatable to gridview

查看:64
本文介绍了问题将jquery数据表实现到gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,
$ b $我正在尝试将jquery数据表实现到我的gridview,但它似乎无法正常工作。



Hello ,
i am trying to implement jquery datatable to my gridview but it dosen't seems to work.

<head id="Head1"  runat="server">
    <title></title>
    <link href="js/datatable/css/jquery.dataTables_themeroller.css" rel="stylesheet"
        type="text/css" />
    <script src="js/datatable/js/jquery.dataTables.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#GridView1').dataTable();
        });
    </script>
</head>
<body>
    <form id="form1"  runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="AccountNrId" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="AccountNrId" HeaderText="AccountNrId" 
                    InsertVisible="False" ReadOnly="True" SortExpression="AccountNrRecId" />
                <asp:BoundField DataField="ClientId" HeaderText="ClientId" 
                    SortExpression="ClientId" />
                <asp:BoundField DataField="AccountNr" HeaderText="AccountNr" 
                    SortExpression="AccountNr" />
                <asp:BoundField DataField="AccountNrDescription" 
                    HeaderText="AccountNrDescription" SortExpression="AccountNrDescription" />
                <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
               
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>" 
            SelectCommand="SELECT * FROM [AccountNrs]"></asp:SqlDataSource>
    </div>
    </form>
</body>    







我得到的结果是一张普通的桌子。我检查了脚本的引用。他们没事。我被困了




what i get in result is a plain table. i have checked the reference of the scripts. they are all right. i am stuck

推荐答案

(document).ready(function(){
(document).ready(function () {


('#GridView1')。dataTable( );
});
< / script>
< / head>
< body>
< form id =form1runat =server>
< div>
< asp:GridView ID =GridView1runat =serverAutoGenerateColumns =False
DataKeyNames =AccountNrIdDataSourceID =SqlDataSource1>
< Columns>
< asp:BoundField DataField =AccountNrIdHeaderText =AccountNrId
InsertVisible =FalseReadOnly =TrueSortExpression =AccountNrRecId/>
< asp:BoundField DataField =ClientIdHeaderText =ClientId
SortExpression =ClientId/>
< asp:BoundField DataField =AccountNrHeaderText =AccountNr
SortExpression =AccountNr/>
< asp:BoundField DataField =AccountNrDescription
HeaderText =AccountNrDescriptionSortExpression =AccountNrDescription/>
< asp:BoundField DataField =DateHeaderText =DateSortExpression =Date/>

< / Columns>
< / asp:GridView>
< asp:SqlDataSource ID =SqlDataSource1runat =server
ConnectionString =<%
('#GridView1').dataTable(); }); </script> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="AccountNrId" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="AccountNrId" HeaderText="AccountNrId" InsertVisible="False" ReadOnly="True" SortExpression="AccountNrRecId" /> <asp:BoundField DataField="ClientId" HeaderText="ClientId" SortExpression="ClientId" /> <asp:BoundField DataField="AccountNr" HeaderText="AccountNr" SortExpression="AccountNr" /> <asp:BoundField DataField="AccountNrDescription" HeaderText="AccountNrDescription" SortExpression="AccountNrDescription" /> <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%


ConnectionStrings:TestingConnectionString%>
SelectCommand =SELECT * FROM [AccountNrs]>< / asp:SqlDataSource>
< / div>
< / form>
< / body>
ConnectionStrings:TestingConnectionString %>" SelectCommand="SELECT * FROM [AccountNrs]"></asp:SqlDataSource> </div> </form> </body>







我得到的结果是一张普通的桌子。我检查了脚本的引用。他们没事。我被困了




what i get in result is a plain table. i have checked the reference of the scripts. they are all right. i am stuck


这篇关于问题将jquery数据表实现到gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆