Ticket T671819
Visible to All Users

Working and simple example on how to use pagination in Grid Control

created 6 years ago (modified 6 years ago)

I am trying to use pagination in my winforms project, but cannot find any working or complete example in the documentation

The closest I get to an example is this
https://documentation.devexpress.com/CoreLibraries/DevExpress.Data.WcfLinq.WcfInstantFeedbackSource.class
But it assigns an object to e.query without explaining what this object is and where it comes from.

Can I use pagination in a winforms project without using entity framework but with connectiions and datatables build in code ?
And is there a complete and simple example that does not uses components and properties without explaining where to find them ?

There are lots of pages in the documentation about this subject but all are missing information on where to find the components/properties
Or they use entity framework or you have to choose an existing connection…
I need an explanation (and example would be nice) to do it without entity framework, without choosing a connection in the designer, and using components that I can find in VS Toolbox (or create in code)

There is lots of talk about 'server mode' but not a single page explains me where to find it or how to use it

Answers approved by DevExpress Support

created 6 years ago (modified 5 years ago)

Hello Guido,

Our Server Mode Data Sources require the direct connection to a database or an OData service and do not work with DataTables. I suggest that you consider the possibility of using DevExpress ORM Tool or any other LINQ-based ORM tool to load data. In this case, you will be able to use our Server Mode components.

Alternatively, consider using our VirtualServerModeSource in your scenario as a bridge between GridControl and your pagination logic (SqlPagination). To make your application work as expected, it is enough to handle two main events:
1) ConfigurationChanged to supply the initial batch of data.
2) MoreRows to supply a subsequent batch of data.
I've created a simple sample to demonstrate the main idea of this approach.
I also recommend you review our demo for a more complex example: Infinite Scrolling module in the XtraGrid MainDemo

If this solution isn't suitable, you can implement pagination using the SQL server capabilities. Most SQL servers allow you to implement pagination over a given SQL query in the same manner as demonstrated in this StackOverflow discussion: What is the best way to paginate results in SQL Server.

See also:
Grid Control - How to implement the pagination functionality
Grid Control - How to implement the pagination functionality using SQL queries

    Show previous comments (2)
    Sasha (DevExpress Support) 5 years ago

      Hi,

      We haven't heard back from you for a while. Would you please take a moment to share your feedback regarding this case?

      • Did you implement the required functionality?
      • What approach did you choose?
      • Did you try Server Mode or Infinite Scrolling?
      • If paging functionality is more preferable, would you please clarify why? What are your requirements and scenario? Is that correct that you cannot use existing Server Mode data sources to show your data?

      We need this information to better understand your real-life scenario and check if we can improve our Grid Control to address your requirements in future versions of our components.

      Thank you for your cooperation in advance.

        Hello,
        sorry I did not responded for a while. I have been away for about a year.
        Anyway, I would like to look at the MainDemo from the link, but unfortunate firefox does not recognize the url. It does not knows dxdemo:// and expects something like https:// or http://
        Is this an error on your site or is firefox not supported ?

        An option like GridMode in Delphi would be so nice in the GridView, any change this will make it into the GridView sometime ?

        Sasha (DevExpress Support) 4 years ago

          Hello Guido,

          Thank you for the update. To avoid mixing multiple questions in one thread, I've created a separate ticket regarding the demo link issue: Cannot run a demo when a link is opened in the FireFox browser. I will address it shortly.

          I also noticed that you created another ticket regarding the GridMode feature: does the winforms GridView also has something like the GridMode in Delphi ?. Let's discuss this topic there.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.