The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Support for Paging

Last post 07-14-2008, 11:19 AM by David.Parsons. 3 replies.
Sort Posts: Previous Next
  •  07-13-2008, 10:57 PM 10228

    Support for Paging

    Hi All,

     

    I would like to implement paging on my datagrid with entityspaces.

    I saw a link that would help me do that: How To Perform Paging with the DataGrid Windows Control by Using Visual C# .NET--> http://support.microsoft.com/kb/307710

    My problem is that I am using EntitySpaces with my business objects. This paging method uses datatable population. How can i do that with EntitySpaces? I couldnt find anything that would let me automatically populate a datatable.

     An am i on the right track? is this what i should do in order to implement datagrid paging? 

    Thanks very much,

    Chesca


    Thanks Very Much,
    Francesca
  •  07-14-2008, 12:31 AM 10231 in reply to 10228

    Re: Support for Paging

    Hi Chesca

    There is paging support built in to EntitySpaces so you shouldn't need a datatable - if you take a look in the getting started pdf that comes with the trial that should help (I think) - if not then search the forum here for paging - there's a whole heap of posts about it.

    Cheers

    Martin

  •  07-14-2008, 7:22 AM 10235 in reply to 10231

    Re: Support for Paging

    If you are using ASP.NET our esDataSource can do automatic paging for you if you are using a database that supports the paging syntax such as SQL 2005. Also, our DynamicQuery API supports paging as well.

    Code:
    EmployeesCollection coll = new EmployeesCollection();
    coll.Query.es.PageSize = 30;
    coll.Query.es.PageNumber = 5;
    coll.Query.Load();

    The above query would load the 5th set of 30 records and only return those from the database and you can bind directly to "coll" and not a DataTable, however, the "Table" property is protected and you could expose it if you need to, but you really shouldn't neeed to. 


    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  07-14-2008, 11:19 AM 10239 in reply to 10228

    Re: Support for Paging

    The following return a DataTable:

    1. DynamicQuery's obj.Query.LoadDataTable() loads records from the database based on an EntitySpaces DynamicQuery. It returns a DataTable, whereas, obj.Query.Load() will populate your collection and return a boolean true if at least one record was loaded.
    2. The protected FillDataTable methods which can be used in your Custom classes. See the EntitySpaces API chm that is installed in your Start Menu for examples.
    3. The protected Table property, which can be used in your Custom classes to gain access to the underlying DataTable for an already loaded collection.

    In a windows application (as opposed to ASP.NET), I think most people use paging to reduce network traffic and memory consumption. The article you cited does not address either of these and seems to be more presentation oriented. As Martin and Mike noted in their posts, if you are using SQL Server 2005+, then EntitySpaces' DynamicQuery supports true server-side paging.

    But, let me throw in my 2 cents regarding presentation. As an end user, I've never cared for VCR-like navigation, and paging is only a minor improvement over that. I would much rather be presented with a simple filtering mechanism, client names that begin with 'C', for example, and then, scroll though a sorted, filtered list to find the record I'm interested in. In EntitySpaces, that can be accomplished either by loading an entire collection and using the collection.Filter property before binding, or by using the user's criteria in a DynamicQuery, and loading just those records for binding to the grid. Just some food for thought.


    David Neal Parsons
    www.entityspaces.net
View as RSS news feed in XML