Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q1 2012 released 04/11/2012
select

Grid / Virtual Scrolling and Paging

Virtual scrolling and paging:
  • Drag the vertical scroll and release it to navigate to the desired page
1024811120
1024842100
102487250
102491490
1024951400
1025041100
1025051350.15
1025065150.15
102512260.05
1025157150.05
1025165200
1025220400.05
1025233250.05
1025260400
 Page 1 of 3572, items 1 to 14 of 50000.


Yahoo-style scrolling:
  • Drag the vertical scroll to the bottom to load additional records on demand

Alfreds FutterkisteMaria AndersSales RepresentativeObere Str. 57Berlin
Ana Trujillo Emparedados y heladosAna TrujilloOwnerAvda. de la Constitución 2222México D.F.
Antonio Moreno TaqueríaAntonio MorenoOwnerMataderos 2312México D.F.
Around the HornThomas HardySales Representative120 Hanover Sq.London
Berglunds snabbköpChristina BerglundOrder AdministratorBerguvsvägen 8Luleå
Blauer See DelikatessenHanna MoosSales RepresentativeForsterstr. 57Mannheim
Blondesddsl père et filsFrédérique CiteauxMarketing Manager24, place KléberStrasbourg
Bólido Comidas preparadasMartín SommerOwnerC/ Araquil, 67Madrid
Bon app'Laurence LebihanOwner12, rue des BouchersMarseille
Bottom-Dollar MarketsElizabeth LincolnAccounting Manager23 Tsawassen Blvd.Tsawassen
B's BeveragesVictoria AshworthSales RepresentativeFauntleroy CircusLondon
Cactus Comidas para llevarPatricio SimpsonSales AgentCerrito 333Buenos Aires
Centro comercial MoctezumaFrancisco ChangMarketing ManagerSierras de Granada 9993México D.F.
Chop-suey ChineseYang WangOwnerHauptstr. 29Bern
Comércio MineiroPedro AfonsoSales AssociateAv. dos Lusíadas, 23Sao Paulo


  • Virtual scrolling for RadGrid can be attained by ajaxifying the control via RadAjaxManager or RadAjaxPanel. Setting the ClientSettings -> Scrolling-> EnableVirtualScrollPaging property of the grid to true and dragging the grid scrollbar with the mouse, you can change the grid pages just like in Microsoft Word®. When scrolling with the virtual scrollbar, RadGrid executes AJAX requests to change the pages (triggered by the RadAjaxManager or RadAjaxPanel respectively), i.e. no postbacks are performed. The overall behavior is smooth and with no flicker.
    This example also features the AJAX loading template that RadAjaxManager/RadAjaxPanel shows during the AJAX request execution. It is an indicator which enriches the user experience when browsing data in AJAX mode. More about the AJAX loading template you can find in the Loading Template example from the RadAjax section of the Quick Start Framework.

    The second grid in this demo represents how to perform google-style scrolling when dragging the vertical grid scroll. When the scroll reaches the bottom, an ajax request is triggered to provide extra records in the table. Additional data will be supplied as long as the rendered rows are less than the entire source records count.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="vb" AutoEventWireup="false" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.GridExamplesVBNET.AJAX.VirtualScrollPaging.DefaultVB" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="telerik" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="telerik" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="telerik" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <telerik:HeadTag runat="server" ID="Headtag2"></telerik:HeadTag>
    </head>
    <body class="BODY">
        <form runat="server" id="mainForm" method="post">
            <telerik:Header runat="server" ID="Header1" NavigationLanguage="VB"></telerik:Header>
           <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
            <!-- content start -->
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

                <script type="text/javascript">
                <!--
                function HandleScrolling(e)
                {
                  var grid = $find("<%=RadGrid2.ClientID %>");

                  var scrollArea = document.getElementById("<%= RadGrid2.ClientID %>" + "_GridData");
                  
                  if(IsScrolledToBottom(scrollArea))
                  {
                    var currentlyDisplayedRecords = grid.get_masterTableView().get_pageSize() * (grid.get_masterTableView().get_currentPageIndex() + 1);
                    
                    //if the presently visible items are less than the entire source records count
                    //trigger an ajax request to increase them
                    if(currentlyDisplayedRecords < 100)
                    {
                      $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("LoadMoreRecords");
                    }
                  }
                }
                //this method calculates whether you have reached the bottom when dragging the vertical grid scroll
                function IsScrolledToBottom(scrollArea)
                {
                    var currentPosition = scrollArea.scrollTop + scrollArea.clientHeight;
                    return currentPosition == scrollArea.scrollHeight;
                }
                -->
                </script>

            </telerik:RadCodeBlock>
            <div class="bigModule">
                <div class="bigModuleBottom">
                    <span class="title">
                        Virtual scrolling and paging:</span>
                    <ul>
                        <li>Drag the vertical scroll and release it to navigate to the desired page</li>
                    </ul>
                </div>
            </div>
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel2" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
            <telerik:RadGrid ID="RadGrid1" Width="97%" AllowPaging="True" PageSize="14" AllowSorting="True"
                runat="server" AllowCustomPaging="true" VirtualItemCount="50000">
                <PagerStyle Mode="NumericPages" />
                <MasterTableView TableLayout="Fixed" />
                <ClientSettings>
                    <Scrolling AllowScroll="True" EnableVirtualScrollPaging="True" UseStaticHeaders="True"
                        SaveScrollPosition="True"></Scrolling>
                </ClientSettings>
            </telerik:RadGrid>
            <br />
            <hr />
            <div class="bigModule">
                <div class="bigModuleBottom">
                    <span class="title">
                        Yahoo-style scrolling:</span>
                    <ul>
                        <li>Drag the vertical scroll to the bottom to load additional records on demand</li>
                    </ul>
                </div>
            </div>
            <br />
            <telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource1" AllowSorting="True"
                runat="server" AllowPaging="true" PageSize="15" Width="97%">
                <PagerStyle Visible="false" />
                <MasterTableView TableLayout="Fixed" />
                <ClientSettings>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />
                    <ClientEvents OnScroll="HandleScrolling" />
                </ClientSettings>
            </telerik:RadGrid>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
            </telerik:RadAjaxLoadingPanel>
            <br />
            <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                ProviderName="System.Data.SqlClient" SelectCommand="SELECT CompanyName, ContactName, ContactTitle, Address, City FROM Customers"
                runat="server"></asp:SqlDataSource>
            <!-- content end -->
            <telerik:Footer runat="server" ID="Footer1"></telerik:Footer>
        </form>
    </body>
    </html>

Get more than expected!

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2012 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451