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
695
Question about incosistency value at UltraGrid.AfterCellUpdate(e.cell.originalvalue)
posted

Hi,

I assign a ValueList to a cell: -

Infragistics.Win.ValueList vl;

vl = grid.DisplayLayout.ValueLists.Add("TestValueList");

vl.ValueListItems.Add(1, "A");

vl.ValueListItems.Add(2, "B");

grid.DisplayLayout.Bands[0].Columns[2].ValueList = grid.DisplayLayout.ValueLists["TestValueList"];

Then at UltraGrid.AfterCellUpdate(): -

private void grid_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)

{ …

                grid.EventManager.SetEnabled(Infragistics.Win.UltraWinGrid.GridEventIds.A      fterCellUpdate, false);

 

                                if (e.Cell.OriginalValue.ToString() == "A")

                                { e.Cell.Value = 1; }

                                else

                                { e.Cell.Value = 2; }

                                grid.EventManager.SetEnabled(Infragistics.Win.UltraWinGrid.GridEventIds.A      fterCellUpdate, true);

 

 }

 

However, I couldn’t get a consistent value back at the e.Cell.OriginalValue: -

Original value selected is A

Test attempt

Value

Text

OriginalValue

Select “B” in the list

2

B

A

Select “A” in the list

1

A

2

 Why the OriginalValue sometimes return me Text of the value list and sometimes is the selected index?

How can i restored the original value?

Thanks

Parents
No Data
Reply
  • 469350
    Offline posted

    The OriginalValue should not be returning an "A". "A" is the text of the field, not the value.

    I'd need a sample demonstrating this behavior in order to look into it, though. This could just be a timing issue in terms of how the grid is being populated, what the values in the data source are, and in what event you are attaching the ValueList.

    Either way, Brian is correct. I'm not sure why the code you have here is trying to accomplish, but setting the Value of the cell in the AfterCellUpdate event is probably not a good idea. Perhaps if you could tell us what you are trying to do, we can suggest a better way to do it.

Children
No Data