This is a migrated thread and some comments may be shown as answers.

client side paging in RadGrid

1 Answer 569 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Satish
Top achievements
Rank 1
Satish asked on 25 Sep 2014, 07:44 AM
Hi ,
i want to implement client side pagination in radgrid how i can achieve it ?

below is the code for binding the data from client side , here only i am getting full set of data ,so next time when i click on pagenumber i don't want to do post back and i don't want to hit Database when i click on page number and also no postback. 

can any one send me sample code how to implement client side pagination.

 var serviceURL = 'http://localhost:1100/Invoice/InvoiceService.svc';
               // debugger;
                var jsonData;
                $.get(serviceURL, null, function (jsonData) {
                    try {
                        if (jsonData.length > 0) {
                         //   alert(jsonData);
                         //   debugger;
                            var grid = $find("<%=rgSiteorAcctDtls.ClientID%>");
                            var MasterTable = grid.get_masterTableView();
                             MasterTable.set_dataSource(jsonData);
                          MasterTable.dataBind();
                        }
                    }
                    catch (e)
                    { alert(e.message); }

                }
                ); 


.aspx code


<telerik:RadGrid ID="rgSiteorAcctDtls" ShowStatusBar="true" runat="server" AutoGenerateColumns="false" Skin="DV"
                            EnableEmbeddedSkins="false" GridLines="None" AllowMultiRowSelection="true"
                            BorderStyle="None" PageSize="5" AllowPaging="true" >
<MasterTableView>
   <Columns>
<telerik:GridBoundColumn DataField="VendorName"  HeaderText="Vendor" />
 <telerik:GridBoundColumn DataField="SiteName" HeaderText="Site "  />
some other columns...
 >

i tried below url but no help

http://demos.telerik.com/aspnet-ajax/grid/examples/data-binding/client-side/programmatic/defaultcs.aspx







1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 30 Sep 2014, 07:04 AM
Hi,

Actually with the current implementation the entire data is bound to the grid however paging is not handled. If you examine the linked online demo you will notice that when a page command is fired it is canceled and the GetData web method is called again. This is needed as when programmatic binding is used once a page,sort or filter command is fired one should rebind the grid using the concrete subset of data that matches the criteria.

Considering the above you can resolve the problem in two ways.
  1. Manually handling things as demonstrated in the online demo. Note that when following this approach you should modify the web service so it returns the paged data and call it on every page command.
  2. Bind the grid to a RadClientDataSource as demonstrated here in which case all operations will be automatically handled.


Regards,
Angel Petrov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Satish
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or