Skip to main content

Built-in Row Cache

  • 2 minutes to read

The ASPxGridView’s ASPxGridView.EnableRowsCache property allows you to enable or disable the built-in row data cache.

The ASPxGridView.EnableRowsCache property is set to true (the default setting) and ASPxGridView stores its current content in grid cache memory for quick access. If the request to the server is not instantiated by ASPxGridView, or if the operation does not require data reload (for example, when you move or hide columns), then ASPxGridView will use cached data. This improves Web application scalability and individual operation performance because there is no need to access a database in that particular cycle.

In some cases, for instance, when the ASPxGridView displays real-time data, you may wish to disable the data cache feature. To do this, set the ASPxGridView.EnableRowsCache option to false. We also recommend that you disable this option when binding to data created at runtime, because the DataBind method call always reloads data from the server.

Note

If you use custom objects that utilize a referenced association, ASPxGridView also tries to cache references. The serialization of a custom object copies data row values (from a datasource) into an internal data collection. However, object deserialization (restoration from String to object) can raise an exception:

TypeConverter cannot convert from System.String.

One solution is to set the ASPxGridView.EnableRowsCache property to false to turn off this feature. This solution is acceptable when the page doesn’t have multiple 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:ASPxGridView ID="ASPxGridView1" runat="server" EnableRowsCache="False" ...

For more detailed information, see the ASPxGridView Row Cache online Knowledge Base article.

See Also