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
235
Binding valuelist dynamically to a ultrawingrid
posted

Hi,

I am binding a valuelist to my ultrawingrid as shown in the attached sample. the value list items can change based on the value of the status column.

click the mouse on the cell on the 3rd column

1. when i change the value in the value list 1st row the cell updates properly

2.  when i change the value in the value list 2nd row the cell updates properly

3. when i try to change the value in value list in 3rd row it changes the cell value of the 1st row.

similarly if we edit multiple rows.. all the previous edited rows get affected once we move the move to a new row

Please help me in resolving this.

thank you.

 

ValueListSample.rar
Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    Changing the ValueList for the column will not work correctly, because when the grid paints a cell, it needs the ValueList to convert the DataValue from the cell into the matching DisplayText  on the list - and if the list is not there, it cannot do it.

    What you should do here is set the ValueList on the cell instead of on the column.

    Or, you could check out this article which shows how to do this with a single list that uses filtering.

    Creating a dropdown list in a grid cell whose list values are dependent on another cell - Windows Forms - Infragistics Community

    By the way... your sample has some pretty strange code in it. For example, this line of code is going in circles:

    UltraGrid1.ActiveCell.Column.Header.Column.ValueList = BuildStatusList(UltraGrid1.ActiveRow.Cells("Status").Value.ToString)

    You are getting the Column property on the cell here, then getting the Header, and then going back to the column. These two objects are exactly the same:

    UltraGrid1.ActiveCell.Column = UltraGrid1.ActiveCell.Column.Header.Column

     

    Anyway, what you really should be doing is this:

    UltraGrid1.ActiveCell.ValueList = BuildStatusList(UltraGrid1.ActiveRow.Cells("Status").Value.ToString)

     

Children