Silverlight Datagrid Paging

No.of Views1662
Bookmarked0 times
Downloads 
Votes0
By  opencv   On  16 Feb 2010 00:02:53
Tag : Silver Light and XAML , How to
Silverlight Datagrid Paging
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

One of the problems I met in Silverlight 2 was paging option in viewing large data content. And to do this I googled this and found several good examples but the best was done by Manish Dalal. In every click to “next” the new set of data is taken from list.

I search about this problem and found a helpful post:

Stealth paging refers to the concept of retrieving data in background just before it is needed. You start by loading DataGrid with only one or two pages worth of data, just enough to cover the screen and some more. Now when user starts scrolling, and nears the end of available rows to show, we fetch additional data and add it to the data collection. User continues scrolling, without ever realizing that data was fetched in the background. [from this blog]

In this article I post the modified version of the Datagrid paging:

{codecitation class="brush: csharp; gutter: true;" width="650px"}

public class PeopleService {

[OperationContract]
public List
GetData(int startRow, int endRow) {
List
personList = new List
();
for (int i = startRow; i < endRow; i++) {
personList.Add(new Person() {

//get row i from the database

FirstName = string.Format("Ali"),
LastName = string.Format("Veli"),
Age = i,
City = string.Format("Izmir"),

});
}

return personList;
}

}

{/codecitation}

I hope this help to you lot and save time to work in silver light paging.

    Download Source Code

    Thank you

    Hüseyin Çakır

    http://huseyincakir.wordpress.com/


     
    Sign Up to vote for this article
     
    About Author
     
    opencv
    Occupation-Not Provided
    Company-Not Provided
    Member Type-Fresh
    Location-Not Provided
    Joined date-03 Jul 2009
    Home Page-Not Provided
    Blog Page-Not Provided
     
     
    Other popularSectionarticles
    Comments
    There is no comments for this articles.
    Leave a Reply
    Title:
    Display Name:
    Email:
    (not display in page for the security purphase)
    Website:
    Message:
    Please refresh your screen using Ctrl+F5
    If you can't read this number refresh your screen
    Please input the anti-spam code that you can read in the image.
    ^ Scroll to Top