Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
UltraWinGrid with dependent combos
posted

I'm working with UltraWinGrid (Infragistics2.Win.UltraWinGrid.v11.1 11.1.20111.2111) with 2 UltraCombo columns. A dropdownlist in a grid cell whose list values are dependent on another cell.(Combo1, Combo2).
Load all values in Combo2 and data will filter according to Combo1 in BeforeCellActivate event.... (http://blogs.infragistics.com/winforms/codesamples/creating-a-dropdown-list-in-a-grid-cell-whose-list-values-are-dependent-on-another-cell.aspx)
It's ok for introducing new rows because combo values are filtered.
But, to open the form and load grid with data values, the Combo2 description is wrong.

Example:
STATES: (Combo1)
IdState - Name
================
1         - State1
2         - State2

Combo1.ValueMember = IdState
Combo1.DisplayMember = Name

CITIES: PK(IdState,IdCity) (Combo2)
IdState - IdCity - Name
========================
1         - 1          - City1
2         - 1          - City2

Combo2.ValueMember = IdCity
Combo2.DisplayMember = Name

CUSTOMER (table):
IdCustomer - Name          - IdState(Combo1) - IdCity(Combo2) -.....
===================================================
1                - Customer1  - 2                          - 1

CUSTOMER (columns of the grid):
IdCustomer - Name         - State (Combo1)  - City (Combo2)
========================================================
1                - Customer1   - State2                - City1 --> (ERROR! Is City2!!)


When loading the grid and display customer data, such as Combo2 is full load, shows the description 'City1' (ERROR! Is City2!!)(the combo2 it's not filtering).

How can I solve the problem????
Must be filtered the combo in every row to the grid to display correct data values????
How can I work with dependent combos??

Thanks in advance.

  • 71886
    Offline posted

    Hello ddol,

    I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.

  • 469350
    Offline posted

    Hi,

    The article you cite here makes the assumption that the ValueMembers in the second combo are unique. If they are not unique, as in this case, then this approach won't work because all of the items are always available in the second combo, even thought some are hidden.

    If it's possible, I would recommend making the idCity field unique.

    If that's not possible, then you would have to take an alternative approach to implementing this. Instead of a single combo in the second column that contains all possible values, you would have to assign a different Combo/ValueList to each cell in the second column based on the first column's value for that row. Instead of filtering the second combo, you assign a different combo to each cell, as needed. For efficiency, it would probably be a good idea to re-use the same Combos as often as possible. For example, if row 0 has selected State 1 and row 10 has also selected State 1, then the City column in each of those rows could use the same Combo.