Welcome to the Xceed Community | Help
Community Search  
More Search Options

Update items in combo box CellEditorManager based on another cell value

Sort Posts: Previous Next
  •  01-26-2012, 8:05 PM Post no. 31616

    Update items in combo box CellEditorManager based on another cell value

    I'm trying to update the items in a combo box in one cell, based off the value of a combobox in another cell. In the ActivatingControl event. I've tried adding and removing items from the WinComboBox returned by the CellEditorEventArgs.Control but I receive an error saying that the datasource does not support insertion or deletion. I get the same thing when attempting to remove items from the CellEditorEventArgs.Cell.CellEditorManager. I've also tried to update the datasource directly, which doesn't error but doesn't update the combo box either.

     I'm setting up the combo box as follows:

    System.Collections.Generic.SortedList<int, String> prodList = oApplication.getProductList();

    cbprod.TemplateControl.AllowFreeText = false;

    cbprod.TemplateControl.DropDownSize = new Size(g.Columns[1].Width * 2, 150);

    cbprod.TemplateControl.DropDownControl.Columns[0].VisibleIndex = 1;

    g.Columns[1].CellEditorManager = cbprod;

    g.Columns[1].CellViewerManager = new Xceed.Grid.Viewers.ComboBoxViewer(prodList.ToList(), "", "Value", "%Value%, %Key%");

    g.Columns[1].CellEditorManager.ActivatingControl += AppProduct_ActivatingControl;

    g.Columns[1].CellEditorManager.DeactivatingControl += AppProduct_DeactivatingControl;

     

    Since I've tried 4 different ways of adding and removing items as described above, I didn't include that code here. I was hoping to get some suggestions on how to do it with the setup I posted above.

     

    Thanks,

    Leo

  •  01-30-2012, 11:52 AM Post no. 31624 in reply to 31616

    Re: Update items in combo box CellEditorManager based on another cell value

    Hi Leo,

    Just to better understand the issue, are you able to send me a small self contained sample application so that I can investigate it further? My goal is to understand and see how your application will look like with the data in the GridControl and what possible real-life values will the Grid be populated with. With your sample, I will be able to provide you with an answer that is tailored to your specific means.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
  •  02-01-2012, 6:03 PM Post no. 31631 in reply to 31624

    Re: Update items in combo box CellEditorManager based on another cell value

    Attachment: FMTTest.zip
    I worked up a quick simple example. Hopefully it'll help you understand what I'm trying to do.
  •  02-03-2012, 1:43 PM Post no. 31635 in reply to 31631

    Re: Update items in combo box CellEditorManager based on another cell value

    Hi Leo,

    After reviewing your sample, I noticed that the code for the ActivatingControl/DeactivatingControl was not included. Are you able to send me your updated sample? In theory and practice, you should be able to extract the source of the ComboBox from the ActivatingControl (because you have access to the actual instance) and replace the source with a modified collection.

    I do have 1 question for you. When you say that you want the value of one ComboBox to affect the ComboBox in another cell, are you talking about:

    - another cell in a different column, same row?

    - another cell in the same column, different row?


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
  •  02-04-2012, 7:11 PM Post no. 31639 in reply to 31635

    Re: Update items in combo box CellEditorManager based on another cell value

    Attachment: FMTTest.zip

    Hey Marc, I did have that code in there so I think I sent the wrong zip. I've attached the sample again, let me know if it's the right one.

     I am trying to update a cell in different column in the same row.

  •  02-06-2012, 4:26 PM Post no. 31643 in reply to 31639

    Re: Update items in combo box CellEditorManager based on another cell value

    Attachment: forum test.zip

    Hi Leo,

    After looking at your sample application, I was noticing that in the ActivatingControl event, you were checking to see if the ComboBox in the last column had a SelectedItem. The only issue is that the control was always null. You are also going to need to localize your ComboBoxes and assign them different data sources. I have updated your sample application to show the changes.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.