Gets or sets whether data caching is enabled.
true, to enable data caching; otherwise, false.
The default is false.
The GridView extension is able to store its data (the data of the current grid page) in memory for quick access. This might help avoid repeated database calls when performing various operations that don't require reloading data (e.g., rearranging or hiding columns). For instance, this can be useful when the GridView is used in Database Server Mode - to reduce the number of database calls. To enable data caching, set the EnableRowsCache option to true.
By default, row data caching is disabled within the GridView. It is recommended to leave the EnableRowsCache property disabled in the following cases:
Note that the EnableRowsCache option must be disabled in the following cases:
If you use custom objects that utilize a referenced association, the GridView 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 EnableRowsCache 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