I have a grid set up with some cells set to style = dropdownvalidate with some valuelists behind them. They work perfectly unless I set a value at run-time before showing the grid. If I do this, and you try to change the value using the dropdown, it will change but then after the cell loses focus, the value reverts back to the original. I've messed with this for a while now and am stumped.
Okay, this makes perfect sense, then. You are setting the Value of the cell inside the InitializeRow event. So you are constantly overwriting it.
You are probably expecting that the InitializeRow event only fires once, but that is not the case. This event fires every time a cell value changes. It's designed that way so that if you are coloring a cell based on the value or changing a ValueList based on another cell's value, it works every time the values change.
So if you want to initialize the value of a cell, you either need to check e.ReInitialize so that you only do it once. Or else you need to do it outside of the InitializeRow event.
In this case, I'm the user :) as this is still in development. That being said, I'm not entering anything, I'm selecting from the list, so I don't think it was be a datatype problem. Also, as long as I don't set the value before showing the grid, the selection will 'stick' just fine. I'll see if I can piece together a sample project, in the mean time, here is a couple of snippets of code that might give you a clue as to where I have gone wrong.
This is how I assign the valuelist to the cell, in the InitializeRow handler. It checks to see what the value is in the first column, and then assigns the appropriate valuelist. The commented out line is where the problem begins. Like it is here, the valuelist will work as expected and keep your selection. If I uncomment this, the correct item will display when I show the grid, but will then revert back to the original if I try to change it.
If e.Row.Cells(0).Value = "LocationId" Then e.Row.Cells(1).ValueList = LoadValueList("Location") 'e.Row.Cells(1).Value = _locationId e.Row.Cells(1).Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate
This is how I load the valuelist, the data is being pulled from another class that holds the datatables with the lookup data I use. The tables have two columns, and Id (int) and Name (varchar).
Private Function LoadValueList(ByVal ListType As String) As Infragistics.Win.ValueList Dim vlLoad = New Infragistics.Win.ValueList Dim _dt As New DataTable _dt = LookUpTables.GetTable(ListType) For ix As Integer = 0 To (_dt.Rows.Count - 1) vlLoad.ValueListItems.Add(_dt.Rows(ix).Item(0), _dt.Rows(ix).Item(1)) Next Return vlLoad End Function
It's tough to sy without seeing it in action. But usually, if the cell reverts to the old value, it's cause of a data type mismatch of some kind. Like if the user enters a string value into a numeric column and the ValueList fails to find a match, the data source will reject the value.
If that's not very helpful (and I suspect it probably isn't in this case), then I recommend that you try to reproduce the issue in a small sample project and Submit an incident to Infragistics Developer Support so they can check it out.