Ticket T1282437
Visible to All Users

ASP.NET MVC GridView Extension: Callback mechanism and session

created 3 days ago

Hello,

In my ASP. NET MVC project I used many GridView Extensions.
To display a grid, an action in a controller first retrieves the data from a database, then builds a view model from this data and finally calls the display of the grid with the view model.
For now I don't use pagination, so all data (that means the data of all pages of the grid) are retrieved from the database and sent to the grids.
Once a grid is displayed, all action done into it (filtering, navigating though grid's pages…) send a callback to the server. In this callback we need to retrieve again all the data from the database, then we have to create the view models and finally we have to call the display of the grid.

As the retrieval of the data from the database can take time, I decided to store them in user server's session at grid's creation and to retrieve them from the session in the callback. This way it is much more faster!

This works fine, but as the number of users of my website is increasing a lot, I will shortly have to use a load balancer.
But load balancing and server's sessions are incompatible.

I there a way to use callbacks (or even not to use them) without session and without having to request each time the database?

Best Regards

Answers approved by DevExpress Support

created 15 hours ago

Hi Emmanuel,

Thank you for contacting us.

GridView is a server-side extension that processes all data operations through callbacks. This behavior is by design and can't be modified.

In your case, I recommend you enable paging or virtual scrolling and use one of the following built-in options to improve the performance:

  • Bind GridView to a queryable source via the BindToEF or BindToLINQ method. In this mode, GridView generates smart queries to request only the data required for screen display in response to user operations (e.g., filtering, sorting, paging). These smart queries are processed by the underlying queryable source (e.g., EntityFramework DbSet) that retrieves the corresponding records from the database. See this demo: Large Database (Server Mode).
  • Implement custom binding for GridView. In this case, you can manually implement methods and logic to retrieve data on-demand based on GridView's current state (e.g., current page, applied filter expression, etc.). See: Custom Data Binding (Advanced).

Please let me know if this helps.

    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.