So what is the moral of the story? Always try to cache the data of the DataGrid control on the server. The Session and Cache objects have been fine-tuned to work well in the most common programming scenarios, such as when dynamically changing information is tossed into and out of shopping carts. In addition, the ASP.NET Session object can work without cookies and support both Web farm and Web garden architectures.
If you don’t want to use in-memory caching, consider caching to a disk. In this case nothing is better than XML, not because it’s cool and trendy, but because it has excellent support from ADO.NET classes. You can use the Session ID to keep each user’s information separated. If you can’t afford caching and applications built according to the data pagination paradox, custom paging is the only way to go.
In this chapter, you received an in-depth exposure to basic DataGrid control issues. You learned how to bind columns and exploit the built-in pagination services. Paging without sorting, and sorting without auto-reverse, is simply inadequate for today’s applications. You now know how to code sorted columns with DataGrid controls. But the saga of the DataGrid control does not end here. In the next chapter, you learn about templates.