Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.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# asp repeater和jquery.dataTable_C#_Jquery_Asp.net - Fatal编程技术网

C# asp repeater和jquery.dataTable

C# asp repeater和jquery.dataTable,c#,jquery,asp.net,C#,Jquery,Asp.net,也许有人能帮我。调用页面时,排序、分页等。。。没有显示。我仅在浏览器中收到此错误:TypeError:$(…)DataTable不是函数 JQuery在布局.master中绑定 对不起,我的英语不好;我希望我已经提供了你需要的所有信息 asp: $(函数(){ $('#nutzer')。数据表({ “bPaginate”:对, “bLengthChange”:false, “bFilter”:错误, “bSort”:正确, “宾福”:没错, “bAutoWidth”:假 }); }); 请参

也许有人能帮我。调用页面时,排序、分页等。。。没有显示。我仅在浏览器中收到此错误:
TypeError:$(…)DataTable不是函数

JQuery在
布局.master中绑定

对不起,我的英语不好;我希望我已经提供了你需要的所有信息

asp:


$(函数(){
$('#nutzer')。数据表({
“bPaginate”:对,
“bLengthChange”:false,
“bFilter”:错误,
“bSort”:正确,
“宾福”:没错,
“bAutoWidth”:假
});
});

请参考下面的代码,以获得一些帮助

<asp:Repeater ID="YourRepeaterId" runat="server">
                                            <HeaderTemplate>
                                                <table class="table table-striped table-bordered table-hover" id="TableId">
                                                    <thead>
                                                        <tr style="background-color:#1261A6 ;color:white">
                                                            <th>Column Name</th>
                                                            <th>Column Name</th>
                                                        </tr>
                                                    </thead>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Column1") %>' />
                                                    </td>
                                                    <td>
                                                        <asp:Label ID="lblNoOfInvestigation" runat="server" Text='<%# Eval("Column2") %>' />
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>

列名
列名
然后添加下面的jquery代码

<script src="jquery.dataTables.min.js"></script>
<link href="jquery.dataTables.min.css" rel="stylesheet" />
<script type="text/javascript">
    $(document).ready(function () {
        $('#TableId').DataTable({
            "paging": true,
            fixedHeader: true,
            scrollY: '60vh',
            scrollX: true,
            scrollCollapse: true
        })
    });
</script>

$(文档).ready(函数(){
$('#TableId')。数据表({
“分页”:正确,
fixedHeader:true,
滚动:“60vh”,
是的,
滚动折叠:对
})
});

还有其他控制台错误吗?需要检查几件事-调用datatables初始化代码时,表是否存在?也许可以尝试将init代码放在document.ready中。在加载datatables js文件之前是否确实加载了jquery文件?document.ready无效,加载了jquery,否则浏览器中将显示错误消息
<asp:Repeater ID="YourRepeaterId" runat="server">
                                            <HeaderTemplate>
                                                <table class="table table-striped table-bordered table-hover" id="TableId">
                                                    <thead>
                                                        <tr style="background-color:#1261A6 ;color:white">
                                                            <th>Column Name</th>
                                                            <th>Column Name</th>
                                                        </tr>
                                                    </thead>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Column1") %>' />
                                                    </td>
                                                    <td>
                                                        <asp:Label ID="lblNoOfInvestigation" runat="server" Text='<%# Eval("Column2") %>' />
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
<script src="jquery.dataTables.min.js"></script>
<link href="jquery.dataTables.min.css" rel="stylesheet" />
<script type="text/javascript">
    $(document).ready(function () {
        $('#TableId').DataTable({
            "paging": true,
            fixedHeader: true,
            scrollY: '60vh',
            scrollX: true,
            scrollCollapse: true
        })
    });
</script>