Skip to main content
All docs
V23.2

Data binding methods such as Eval(), XPath(), and Bind() can only be used for a databound control

Error Description

This error occurs when you use the Eval(), XPath(), and Bind() methods to bind a DevExpress control to a data source if this control is inside a container (another DevExpress control). For example, if the ASPxGridView contains the ASPxComboBox which you try to bind to a data source.

Solution

Do the following to solve this issue:

  • Disable a container control’s ViewState.

  • Call the container’s DataBind method in the page/container’s Init event handler.

  • For the ASPxComboBox: Use the DataBindItems() method instead of the DataBind method. For other editors, you do not need the DataBind method at all as the ASPxGridView binds the editors automatically.

  • For the ASPxGridView as a container: Disable its caching mechanism (EnableRowsCache). It is recommended to bind the grid to a data source in the Page_Init event handler if you bind the grid at runtime.