如何将自定义转发器转换为jquery数据表? [英] How do I convert a custom repeater to jquery datatable?

查看:71
本文介绍了如何将自定义转发器转换为jquery数据表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将下面的这个转发器转换为jquery dataTable,但我不能让它工作。我如何实现这一点,还是有更好的工具可以用来处理那里的分页?我正在使用asp.net webform



我尝试过:



< pre>< asp:Repeater ID =RepeaterRecordrunat =serverOnItemDataBound =RepeaterRecord_ItemDataBoundClientIDMode =Static> 
< HeaderTemplate>< / HeaderTemplate>
< ItemTemplate>
< div class =single-prodcut-img product-overlay pos-rltv>
< a href =Singleproduct.aspx?Product =<%#Eval(Product_Id)%>> < asp:Image ID =ProductImagerunat =serverclass =primary-imageImageUrl ='<%#data:Image / jpg; base64,+ Convert.ToBase64String((byte [])Eval (Product_Image1))%>'/>< / a>
< / div>
< div class =prodcut-name> < a href =Singleproduct.aspx?Product =<%#Eval(Product_Id)%>><%#Eval(Product_Name)%>< / a> < / DIV>
< div class =new-price><%#N+ Eval(Product_Price)%>< / div>

< / ItemTemplate>

< / asp:Repeater>



























< script type =text / javascript> 
$(document).ready(function(){

$('#RepeaterRecord')。prepend($(< thead>< / thead>)。append( $('#RepeaterRecord')。dataTable({
responsive:true,
paging:true,
bAutoWidth:false,
search:true,
iDisplayLength:5,
aLengthMenu:[[5,10,25,50,-1],[5,10,25,50,全部]]
} );
});
< / script>

解决方案

(文件).ready(function( ){


('#RepeaterRecord')。prepend(


(< thead>< / thead>)。append(

i have tried to convert this repeater below to a jquery dataTable but i cant get to make it work. How do i achieve this or is there a better tool i can use to handle pagination out there? i'm using asp.net webform

What I have tried:

<pre><asp:Repeater ID="RepeaterRecord" runat="server" OnItemDataBound="RepeaterRecord_ItemDataBound" ClientIDMode="Static">
                                            <HeaderTemplate></HeaderTemplate>
                                            <ItemTemplate>
                                                    <div class="single-prodcut-img  product-overlay pos-rltv">
                                                        <a href="Singleproduct.aspx?Product=<%#Eval("Product_Id") %>">  <asp:Image ID="ProductImage" runat="server" class="primary-image" ImageUrl='<%#"data:Image/jpg;base64,"+ Convert.ToBase64String((byte[])Eval("Product_Image1")) %>'/></a>
                               </div>
         <div class="prodcut-name"> <a href="Singleproduct.aspx?Product=<%#Eval("Product_Id") %>"><%#Eval("Product_Name") %></a> </div>
                                                            <div class="new-price"><%# "N" +Eval("Product_Price") %></div>

                                                </ItemTemplate>

                                            </asp:Repeater>














<script type ="text/javascript">
    $(document).ready(function () {

        $('#RepeaterRecord').prepend($("<thead></thead>").append($('#RepeaterRecord').dataTable({
            responsive: true,
            "paging": true,
            "bAutoWidth": false,
            "searching": true,
            "iDisplayLength": 5,
            "aLengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]]
        });
    });
    </script>

解决方案

(document).ready(function () {


('#RepeaterRecord').prepend(


("<thead></thead>").append(


这篇关于如何将自定义转发器转换为jquery数据表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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