Product Bundles
DevCraft
All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Web
Mobile
Document Management
Desktop
Reporting
Testing & Mocking
CMS
UI/UX Tools
Debugging
Free Tools
Support and Learning
Productivity and Design Tools
01.
<
telerik:RadGrid
runat
=
"server"
ID
"RadGrid2"
AutoGenerateColumns
"false"
AllowPaging
"true"
02.
PageSize
"2"
>
03.
MasterTableView
04.
Columns
05.
telerik:GridBoundColumn
DataField
"ID"
06.
</
07.
08.
PagerTemplate
09.
input
class
"rgPagePrev"
title
"Previous Page"
onclick="$find('<%#Container.OwnerTableView.ClientID%>').page('Prev');"
10.
value=" " type="button">
11.
"rgPageNext"
"Next Page"
onclick="$find('<%#Container.OwnerTableView.ClientID%>').page('Next');"
12.
13.
14.
15.
ClientSettings
16.
ClientEvents
OnCommand
"command"
/>
17.
18.
<script type=
"text/javascript"
//sample data
var
data =
[
{ ID: 1 },
{ ID: 2 },
{ ID: 3 },
{ ID: 4 },
{ ID: 5 },
{ ID: 6 },
];
mtv =
null
;
function
pageLoad()
{
//cache the ref to MasterTableView
mtv = $find(
).get_masterTableView();
//bind RadGrid
19.
bindGrid(0, 2);
20.
21.
//set virtual items count
22.
mtv.set_virtualItemCount(data.length - 1);
23.
}
24.
command(sender, args)
25.
26.
//cancel to prevent postback
27.
args.set_cancel(
true
);
28.
29.
//calculate page size items
30.
pageSize = mtv.get_pageSize();
31.
index = mtv.get_currentPageIndex() * pageSize;
32.
itemsToTake = Math.min(pageSize, data.length);
33.
34.
35.
bindGrid(index, index + itemsToTake);
36.
37.
bindGrid(startIndex, endIndex)
38.
39.
mtv.set_dataSource(Array.prototype.slice.call(data, startIndex, endIndex));
40.
mtv.dataBind();
41.
42.
</script>