Skip to main content
All docs
V23.2

The 'Key expression is undefined' error occurs when you use LinqServerModeDataSource / EntityServerModeDataSource

Error Description

This error can occur when the LinqServerModeDataSource / EntityServerModeDataSource data sources cannot automatically recognize the key (unique) column from the TableName or QueryableSource specified at runtime.

Solution

Do the following to resolve this issue:

protected void LinqServerModeDataSourceInstance_Selecting(object sender, DevExpress.Data.Linq.LinqServerModeDataSourceSelectEventArgs e) {  
    e.KeyExpression = UNIQUE_KEY_COLUMN_NAME;  
}