Dear,
I want to use the OptionSetEditor in a grid and I have found some examples that uses the UltraOptionSet and adding it to a grid using something likes this: ltraGrid1.DisplayLayout.Rows[2].Cells[1].EditorComponent
this is something I can't use because we have built some framework around infragistics controls. This way it is easier to create custom columns.
this is the code is use to have a column with an OptionSetEditor:
public override void Format(UltraGridColumn column) { base.Format(column); var value1 = new ValueListItem { DataValue = 1, DisplayText = "Yes" }; var value2 = new ValueListItem { DataValue = 2, DisplayText = "No" }; var value3 = new ValueListItem { DataValue = 3, DisplayText = "N/A" }; var settings = new DefaultEditorOwnerSettings(); settings.ValueList = new ValueList { ValueListItems = { value1, value2, value3 }}; var editor = new OptionSetEditor(new DefaultEditorOwner(settings)); column.Editor = editor; }
this code works. It shows the valueList as radiobuttons. The problem I have is that I cant set the value for each row.
If I make a selection in a row and then make a selection in another row, the previous selection gets undone. it's like all the radiobuttons belong to 1 radiobuttongroup
Can this problem be fixed?
Thanks in advanced.
indeed. The datatype was not an integer. After I changed my code made sure my value was an integer it worked.
thx for the help
Hi Sebastian,
Thank you for posting in our forums!
Based on the provided information, your code should work flawlessly, except in the case when the type of the column is not numeric or at least integer. If column’s data type is different, the integer data value will not be committed to the database and the option set will never be set, which would affect in constantly resetting the selection.
Please take a look at the attached sample application and let me know how it behaves on your machine.