Current filter:
                                You should refresh the page.
                                  • Hello.
                                    I have to implement a custom property editor in order to directly show the user multiple columns/informations on a dropdown control on Web platform. Regular lookup is not an option, because there are several fields to set, and the process will became so much faster with the custom control, avoiding the popup lookups and the single-column regular dropdown.
                                    The problem is that I can't get it 100% functional.
                                    I have already followed the instructions on:
                                    https://www.devexpress.com/Support/Center/Question/Details/B221204
                                    and:
                                    http://demos.devexpress.com/ASPxEditorsDemos/ASPxComboBox/MultiColumn.aspx
                                    (in this particular example I can't see how to change the Aspx page, since there's only one page (Default.aspx) for the whole data presentation)
                                    I have already tried the solutions from:
                                    https://documentation.devexpress.com/#Xaf/CustomDocument2678https://www.devexpress.com/Support/Center/Question/Details/Q564246https://www.devexpress.com/Support/Center/Question/Details/Q365327
                                    What I got by now is:-On the "New Customer" DetailView, the combo is multi-column - OK!
                                    -On the "New Customer" DetailView, when I select one record, it does not display the DefaultProperty of my object - NOK!
                                    -On the "New Customer" DetailView, when I save my record, the record set on the custom editor is not saved on the parent object - NOK!
                                    -On the "Customer Listview", the custom editor is shown as an editable combobox - NOK!
                                    Can you give me the directions to get these issues working?
                                    I'm uploading my project to show you what I have done so far.The Module project contains the business classes: Customer and CustomerRating.
                                    The Module.Web project contains the property editor.
                                    The Model.DesignDiffs.xafml of the Module.Web project was changed as follow: BOModel > MultiColumnCombo.Module.BusinessObjects > Customer > OwnMembers > Rating, and changed the PropertyEditorType to CustomerRatingMultiColumnEditor
                                    To simulate the scenario, run the Web project, go to Customer menu item, hit New and fill the Customer Rating property.
                                    Thanks.

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Filipe,

                                Here are solutions for the issues you described:

                                1. You can specify which column's value should be used to display the editor's current value via the ASPxComboBox.TextFormatString property:

                                [C#]
                                dropDownControl.TextFormatString = "{0}";
                                2. Store the object's key value in the editor, and convert the key value to the persistent object in the GetControlValueCore and ReadEditModeValueCore methods. To configure the editor to store the key value, set its ValueField and ValueType properties. In addition, subscribe the inherited EditValueChangedHandler to the ASPxComboBox.ValueChanged event.
                                3. The easiest way to display a read-only editor in the View mode is to let the WebPropertyEditor to create and configure the label control, i.e., do not override the CreateViewModeControlCode method.

                                I have also corrected some other problems. Here is the working editor:

                                [C#]
                                [PropertyEditor(typeof(CustomerRating), false)] public class CustomerRatingMultiColumnEditor : ASPxPropertyEditor, IComplexViewItem { public CustomerRatingMultiColumnEditor(Type objectType, IModelMemberViewItem info) : base(objectType, info) { } IObjectSpace objectSpace; private ASPxComboBox CreateCombo() { ASPxComboBox dropDownControl = new ASPxComboBox(); dropDownControl.Columns.Add(new ListBoxColumn("Description", "Description")); dropDownControl.Columns.Add(new ListBoxColumn("Criteria", "Criteria")); dropDownControl.TextFormatString = "{0}"; dropDownControl.ValueField = MemberInfo.MemberTypeInfo.KeyMember.Name; dropDownControl.ValueType = MemberInfo.MemberTypeInfo.KeyMember.MemberType; dropDownControl.ValueChanged += EditValueChangedHandler; return dropDownControl; } protected override object GetControlValueCore() { if (Editor != null) { return Editor.Value == null ? null : objectSpace.GetObjectByKey(MemberInfo.MemberType, Editor.Value); } return base.GetControlValueCore(); } protected override void ReadEditModeValueCore() { if (Editor != null) { Editor.DataSource = objectSpace.GetObjects<CustomerRating>(); Editor.DataBind(); Editor.Value = PropertyValue == null ? null : objectSpace.GetKeyValue(PropertyValue); } } protected override WebControl CreateEditModeControlCore() { return CreateCombo(); } public new ASPxComboBox Editor { get { return (ASPxComboBox)base.Editor; } } #region IComplexViewItem Members public void Setup(DevExpress.ExpressApp.IObjectSpace objectSpace, DevExpress.ExpressApp.XafApplication application) { this.objectSpace = objectSpace; } #endregion }

                                • Filipe Pavan 03.12.2014

                                  Thanks Anatol.

                                  It works perfect now.

                                • Anatol (DevExpress Support) 03.13.2014

                                  You are welcome!