Built-in Record Caching
- 2 minutes to read
ASPxVerticalGrid provides the ASPxVerticalGrid.EnableRecordsCache property allowing you to enable or disable built-in row data caching.
By default, the ASPxGridView.EnableRowsCache property is set to true and ASPxVerticalGrid stores its current content in the grid cache memory for quick access. So if the request to the server is not instantiated by ASPxVerticalGrid, or if the performing operation does not require the reloading of data (e.g., rearranging or hiding rows), then ASPxVerticalGrid will take data from the cache. Therefore, it increases your Web application's scalability, and the individual operations will be quicker, because there's no database access happening in that particular cycle.
In some cases, for instance, when the ASPxVerticalGrid displays real-time data, it can be useful to disable data caching by setting the ASPxVerticalGrid.EnableRecordsCache option to false. We also recommend that you disable this option when binding to data created at runtime, because calling the DataBind method will always reload data from the server.
If you use custom objects that utilize a referenced association, the ASPxVerticalGrid tries to cache references too. The serialization of a custom object is performed by the ToString method and is performed smoothly. But the object deserialization (restoration from String to object) could be raised with an exception:
TypeConverter cannot convert from System.String.
One solution is to turn off the ASPxVerticalGrid.EnableRecordsCache property. This solution is acceptable when the page doesn't have several grids, and in most cases doesn't affect page performance significantly.
However, you can implement a custom TypeConverter derived class that can convert from the String type correctly. To learn more, see the Code Central example: How to implement a custom TypeConverter class for an XPO object
<dx:ASPxVerticalGrid ID="ASPxVerticalGrid1" runat="server" EnableRecordsCache="False" ...
For more detailed information, see the ASPxGridView Row Cache online Knowledge Base article.