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
580
UltraWinGrid valueList duplicate key
posted

Hi ,

I am using ValueList in UltraWinGrid v9.1.

 

I am creating it by adding items.

MemberGrid.DisplayLayout.ValueLists["testList"].ValueListItems.Add(dt.Rows[i][0], dt.Rows[i][1].ToString());

And assigning it to a cell in MemberGrid_InitializeLayout event.

e.Layout.Bands[0].Columns[0].ValueList = e.Layout.ValueLists["testList"];

 

In some cases I have two items with the same key value. One of them is using Tag to store some extra data.  During MemberGrid_InitializeRow event I have all infomration required to select correct one but when I assign datasource DataGrid.DataSource = dt; first value is alwyas selected.

 

How could I select ValueListItem with tag value when required ?

  • 469350
    Verified Answer
    Offline posted

    Hi,

    You can't. The grid cell only hold one piece of information (the Value). So if your ValueList has duplicate keys, the grid will always select the first one and there is no way around that.

    It sounds like maybe you need an additional column in the grid to hold the extra information.

    Perhaps you could hide the "real" data column in the grid and then use an unbound column with a ValueList that has unique keys. Then you can update the "real" column any time the user updates the unbound column.