如何在ASP .Net中实现DataGrid控件的无限滚动

时间:2013-12-17 05:28:55

标签: jquery asp.net ajax vb.net datagrid

在ASP .Net与vb.net开发的网站中,我希望在一个页面中显示所有10000条记录,但是来自具有无限滚动选项的数据库(如Facebook,twitter)的数据限制。我正在使用Datagrid控件,我从oracle检索数据。

当用户滚动到窗口底部时,它会加载更多的记录,就像Twitter提要页面那样。

创建无限滚动的最佳方法是什么?帮帮我

1 个答案:

答案 0 :(得分:1)

查看jQuery Endless Scroll plug-in

标记:

$(document).ready(function() {
    $('#container').endlessScroll({
        inflowPixels: 100, // start scroll 100 pixels from bottom of DIV
        fireDelay: 2000, // delay in milliseconds
        callback: function (p) {
            // AJAX call to server to fetch more 50, 100 or 
            // whatever amount more of data

        } 
    });
});

<div id="container"></div>

代码隐藏:

Sub Page_Load(sender As Object, e As EventArgs)
    ' Put logic here to load initial 50, 100 or whatever initial amount of rows

End Sub