Ticket T281652
Visible to All Users

LookupEdit control in grid of custom editor readonly or not setting value

created 10 years ago

I have a custom editor in my XAF WinForms project (ProjectRolesEditor) which isn't quite working right.
It is designed to allow the user to easily add, edit and delete PersonProjectRole records for the currently displayed Project. These records represent the join between three tables. Persons, Projects, and ProjectRoles. They show that a person has a particular role on a project (and some other information). (This is a legacy database so doesn't use XAF's built-in join mechanism.)

The grid which shows this information has six visible columns, Person, Company, Project Role, Split Recipient, Retainer Split and Fee Split. The first two are read-only and show the person and company names. (New records are added via a Popup Control Container). The last two columns contain percentages. The Split Recipient column has a RepositoryItemImageComboBox used to let the user select "Person" or "Company" and record "P" or "C" to the database. The percentages and the ImageCombo editors all work correctly, showing existing values and allowing the user to edit them.

The Project Role column has a RepositoryItemLookupEdit as its ColumnEdit property to look up the value from the ProjectRoles collection. My problem seems to be concerned with setting up this editor. The possible values are retrieved correctly from the database by the code and the LookupEdit is bound to this data. However, depending on how I set the FieldName property of the column I can either have (1) the column read-only (dropdown button greyed out), existing data is translated but nothing in this column can be changed OR (2) I can have blanks for existing data, the dropdown active (with all the possible values shown) but any selected value gets blanked out when you leave the column.

The first behaviour happens when I set the FieldName to "ProjectRole.ProjectRoleID".
The second behaviour happens with FieldName set to "ProjectRole".
All other properties of the column and the editor remain the same.

I have probably forgotten to do something really easy but I don't know what.

I've enclosed the code for this relatively small part of the much larger project, and screenshots illustrating the two behaviours . Please have a look over it and let me know how I can alter it to make the ProjectRole column translate the existing values AND allow the user to change them.

Comments (1)
Anatol (DevExpress) 10 years ago

    I apologize for the delay. We need additional time to research the issue. We will keep you informed of our progress.

    Answers approved by DevExpress Support

    created 10 years ago (modified 10 years ago)

    Hello Simon,

    It is hard to provide you with an exact solution since the PersonProjectRolesCollection collection structure is not clear based upon the code you provided.
    Please review the How to: Bind an XPCollection to a LookUp article in help and check the Setting Up the In-Place LookUpEdit Editor section in it.
    Make sure that you have defined the GridColumn.FieldName and RepositoryItemLookUpEdit.ValueMember property values according to it.
    We look forward to your reply once you’ve had the opportunity to implement our suggestion.

      Comments (2)

        Andrew,
        Thanks for the pointers.
        The answer was to set the FieldName of the column to "ProjectRole!" and the ValueMember of its Properties to "(null)".
        I'd have never guessed those settings, neither the ! on the end of the FieldName, nor leaving the ValueMember as (null). Not obvious.
        Thanks again.
        Simon

        DevExpress Support Team 10 years ago

          Hi Simon,

          I am happy to hear that the problem has been resolved. Thank you for letting us know of your progress. Please feel free to contact us if you have any further difficulties. We will be happy to assist you.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.