Skip to main content

Built-in Record Cache

  • 3 minutes to read

The ASPxVerticalGrid control has a built-in cache that stores visible record data and allows the control to avoid additional data binding.

Record Cache Life Cycle

ASPxVerticalGrid copies field values of visible and invisible rows to an internal data collection contained in a hidden field. A page sends the hidden field values to the server with postback and callback data. On the server, this data is deserialized.

When ASPxVerticalGrid requires record data, the control attempts to load that data from the record cache. If all required records are available in the cache, ASPxVerticalGrid does not send a query to the database. Since the record cache contains only visible record data, this mechanism is effective exclusively if a record list on the current page does not change. For example, the record cache is particularly useful in the following scenarios when:

  • A user selects or focuses a record.
  • Another page control initiates a page request. In this case, ASPxVerticalGrid data does not change unless ASPxVerticalGrid is modified on the server side during this request.

Sort, filter, and page operations cause new records to appear on a page. Record cache does not have data for new records and ASPxVerticalGrid sends a query to the database to obtain necessary data.

Methods That Can Force Data Binding

GetRecordValues(Int32, String[]) | Find...TemplateControl
These methods return record values. When you call these methods, ASPxVerticalGrid searches for a value in the record cache. If the required record data is found, data binding does not occur. ASPxVerticalGrid binds to a data source if the record cache is disabled or has no required data.
This method return a record data object rather than record values. ASPxVerticalGrid does not store data objects in the record cache, therefore, these methods cause data binding even if the record cache contains required data.

Disable Record Cache

Set the EnableRecordsCache property to false to disable the record cache. This option can be useful in the following cases:

How to Store Complex Objects in Cache

If you bind a grid to an XPO or custom objects that use a referenced association, the control also tries to cache references. The caching operation is similar to the ToString method. Serialization of a custom object copies data record values from a data source into an internal data collection. However, object deserialization (restoration from string to object) raises an exception:

"TypeConverter cannot convert from System.String"

You can resolve the issue in the following ways: