How do i set the value for ultraCombo dropdownlist when i know the value memeber.
ui_sourceDescription.Value = value; works but if the value is not in the list, then nothing shoudl be selected.
In that case, I would case the control to an IValueList and use the GetText method to find the right row. It is probably more efficient than looping through the rows yourself.
Setting the value throws an exception if the value is not in the list..
I dont want to know if the item is in the list or not. I just want a row to be selected if the value is present in the list.
Setting the Value is a better way.
If you want to determine if the item exists on the list, then you can cast the control into an IValueList and use the GetText method.
I am currently using this.
ui_exemptDescription.SelectedRow = GetSelectedRow(ui_exemptDescription,value);
private UltraGridRow GetSelectedRow(UltraCombo combo, string value) { UltraGridRow selectedRow = null; foreach (UltraGridRow row in combo.Rows) { if (row.Cells[combo.ValueMember].Value.ToString() == value) { selectedRow = row; break; } } return selectedRow; }
I hope there is a better way..