Scenario:
There is a database table with multiple key columns. The corresponding XPO class has a compound key property implemented through a structure, according to the How to create a persistent object for a database table with a compound key article. When a ListView of this class is shown, row-specific ASPxGridView functions, such as the inplace editing and the selection column, are disabled. This happens, because the ASPxGridView control cannot recognize the key value. See how to enable these functions below.
Solution:
In versions 17.1.4 and higher, decorate the key structure with the [TypeConverter(typeof(StructTypeConverter<YourKeyType>))] attribute. The StructTypeConverter<T> Class can serialize the specified structure to a string, which is required to support built-in ASPxGridView functions. See details and an example in the class description.
Note that this class cannot work with structure properties whose type is an XPO persistent class. If you have such a structure, either change it to use simple types, or implement one of the solutions described below.
In versions prior to 17.1.4, use one of the following solutions:
1. Create a custom TypeConverter for the key structure that can convert it to String and vice versa. See an example in the Composite Key Model Not Selectable On Listview ticket. If you have persistent objects in the key structure, modify this solution as described here: XAF Web - ListViews of objects with compound key doesn't show SelectionColumns.
2. Add an ASPxGridView control configured according to your requirements to your application, as described in the How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET) topic. Take special note of the following members and their usage with compound or multi-field keys: ASPxGridView.KeyFieldName Property, ASPxGridView.FindVisibleIndexByKeyValue Method.
If you are an experienced XAF developer, you can implement an ASPxGridListEditor descendant and modify the way how it works with key values to support your data structure.