Ticket T494215
Visible to All Users

CheckedComboBoxEdit - Bound and with DataSource

created 8 years ago (modified 8 years ago)

Hello,

I am trying to use a CheckedComboBoxEdit in the following way:

In the initialize-method I initialize the DataSource-table for the CheckedComboBoxEdit in the following way:

C#
public Editor() {       Worksteps = new XPCollection<T3_Workstep>(editorSession);       Worksteps.Sorting.Add(new SortProperty("Workstep", SortingDirection.Ascending)); // Workstep = int       cbWorkstep_IDNos.Properties.ValueMember = "IDNo"; // IDNo = bigint       cbWorkstep_IDNos.Properties.DisplayMember = "Name"; // Name = nvarchar(256)       cbWorkstep_IDNos.Properties.DataSource = Worksteps; }

Then I connect the "Worksteps"-table to the CheckedComboBoxEdit cbWorkstep_IDNos:

C#
protected override void CreateDataBindings(DevExpress.Xpo.XPBaseObject focusedObject, bool pkEditable = false) {         T3_Machine Machine = focusedObject as T3_Machine;         cbWorkstep_IDNos.DataBindings.Clear();         cbWorkstep_IDNos.Properties.DataSource = null;         cbWorkstep_IDNos.Properties.DataSource = Worksteps;         cbWorkstep_IDNos.SetEditValue(-1);         SetDataBinding(cbWorkstep_IDNos, "EditValue", Machine, "Workstep_IDNos"); // Workstep_IDNos = nvarchar(256) }

If I look into cbWorkstep_IDNos I see the IDNos (See: devexpress - After starting.png). But I expected the Names of the IDNos. If I then open and close the CheckedComboBoxEdit cbWorkstep_IDNos I see the Names out of T3_Workstep.

What am I doing wrong?

Thanks in advance for a quick responce.

Regards,

Andreas Voßhenrich

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

Hello Andreas,

This behavior occurs because the CheckedComboBoxEdit.Properties.Items collection is populated when the popup form is opened the first time if you set your items using the DataSource property.
To populate this collection manually and set EditValue, you can call the CheckedComboBoxEdit.SetEditValue method.
Please try this approach and let me know if it works for you.

    Comments (1)
    AV AV
    Andreas Voßhenrich 8 years ago

      Hi Nadezhda,

      thank's for your help. Your solution works.

      Regards,

      Andreas

      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.