Hi, Mike
I am trying the method you proposed in the post http://community.infragistics.com/forums/p/55961/287029.aspx#287029, "hide the "real" column which contains a single string and use an unbound column whose datatype is List<string> for display to the user. You could then use events of the grid to convert the string to a list (InitializeRow) and the list to a String (BeforeRowUpdate)."
During the test, i found the text in the ultraComboEditor disappeared when the cell lose focus, the cell changed to blank. i pasted some code here,
private void ultraGrid1_InitializeLayout(object sender, IWG.InitializeLayoutEventArgs e)
{
// override the backgroud color of the active cell.
this.ultraGrid1.DisplayLayout.Override.ActiveRowCellAppearance.BackColor = Color.White;
this.ultraGrid1.DisplayLayout.Override.ActiveRowCellAppearance.ForeColor = Color.Black;
this.Columns[StrValue].Hidden = true; // hide the real bound column
this.Columns.Add(m_fakeColName, "NewValue"); // add a fake column
this.Columns[m_fakeColName].DataType = typeof(List<string>);
}
// fill the cell with different controls based on the cell content before the active cell
private void ultraGrid1_BeforeCellActivate(object sender, IWG.CancelableCellEventArgs e)
if (e.Cell.Column.Key.Equals(m_fakeColName))
string property = e.Cell.Row.Cells[StrProperty].Value.ToString();
if (string.IsNullOrEmpty(property)) return;
if (m_propertyAttriDic[property].CtrlStyle == ControlStyle.CheckedListBox)
Columns[m_fakeColName].Style = IWG.ColumnStyle.DropDownList;
if (cell.EditorComponent == null)
UltraComboEditor editor = new UltraComboEditor();
editor.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox;
editor.CheckedListSettings.ItemCheckArea = Infragistics.Win.ItemCheckArea.Item;
editor.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItems;
editor.CheckedListSettings.ListSeparator = new string( FilterHelper.Seperators);
editor.ValueList = this.ultraGrid1.DisplayLayout.ValueLists[propertyName];
this.Columns[m_fakeColName].EditorComponent = editor;
private void ultraGrid1_BeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e)
List<string> values = e.Row.Cells[m_strFakeValueCol].Value as List<string>;
if (values != null)
string newValue = string.Empty;
foreach (string value in values)
newValue += value;
if (values.IndexOf(value) < values.Count - 1)
newValue += new string(FilterHelper.Seperators);
m_filterList[e.Row.Index].Value = newValue;
private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
string value = e.Row.Cells[StrValue].Value as string;
if (!string.IsNullOrEmpty(value))
e.Row.Cells[m_strFakeValueCol].Value = new List<string>(value.Split(FilterHelper.Seperators));
Thanks in advance.
Regards,
louvie
So that means on SAVE i need to call itemnotinlist event?
If you are clicking on a button that doesn't get focus (and therefore the combo does not lose focus), then the control has no way to know that anything happened.
In that case, you could call the IsItemInList method on the control to see if the current entry is valid.
Hi,
I am using itemnotinList event to check if the item is in list when user types in something for both ulreacombo and ultracomboeditor.
But this is validating only when we lost the focus from one control to other. its not validating when the focus is not same combo box.
I need a way that when user types in something that one is not in liat and some "SAVE" button it first validating that combo box.
Currently it wors only on save if i give a focus to smoe other control.
But if i don't give a focus to some otheer control it ill throw an exception because that value is not there in list.
Thank you Mike.
I will try this.
Louvie
Hi louvie,
Okay, I took a look at your sample and it was a struggle, but I figured out how to make it work.
There are two small changes I made.
Apparently, the multi-select functionality only work with a column whose DataType is List<object>. It will not work with List<string>.
I'm not sure why this is - it might be a bug or an oversight. I'm going to ask Infragistics Developer Support to write it up so we can look into it.
The second issue is that the multi-select functionality does not work in DropDownList style. So the user must be able to type in to the list, you cannot force them to only select from it.
Again, this seems like an odd limitation and I'm not sure if this is intentional or a bug, but I will ask Dev Support to look into this, also.
Anyway, I attached a modified version of your sample here that now works correctly. I commented my changes with the word "IGMikeS", so you can find them easily by searching for that string.